帮忙看看这段PHP到底是哪里有问题。 Parse error: parse error, unexpected T_LNUMBER in D:\oa\test.php on line 19 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $result = mysql_query($sql) or die("Could not query: ". mysql_error()); <?php$link = mysql_connect("localhost", "root", "0000") or die("Could not connect: " . mysql_error());//mysql_select_db('socooloa', $link) or die ('Can\'t use foo : ' . mysql_error());mysql_select_db("socooloa");$sql="select * from accountbook where accountbookname='流水' order by transactiondate desc;";//$result = mysql_query($sql) or die("Could not query: . mysql_error());$result = mysql_query($sql) or die("Could not query: ". mysql_error());?><table border="0" style="border-collapse: collapse" width="100%"> <tr> <td>查询时间:</td> </tr></table><meta http-equiv="Content-Language" content="zh-cn"><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td align="center">交易时间</td> <td align="center">描述</td> <td align="center">收入</td> <td align="center">支出</td> <td align="center">余额</td> <td align="center">备注</td> <td align="center">操作</td> </tr><?phpwhile($line = mysql_fetch_array($result)){?> <tr> <td align="center"><?print(mysql_result($result,"transactiondate"));?> </td> <td align="center"><?print(mysql_result($result,"transactiondescription"));?> </td> <td align="center"><?php $tem2=sprintf("%01.2f",mysql_result($result,"transactionsum")); if(mysql_result($result,"transactionsum")>=0){ print($tem2); $temp1=$temp1+$tem2; } ?> </td> <td align="center"><?php if(mysql_result($result,"transactionsum")<0){ print($tem2); $temp2=$temp2+$tem2; } ?> </td> <td align="center"><?php $tem3=sprintf("%01.2f",mysql_result($result,"balance")); print($tem3); ?> </td> <td align="center"><?print(mysql_result($result,"otherinfo"));?> </td> <td align="center"><?print(mysql_result($result,"operator"));?> </td> </tr><?php}?></table><?php$temp3=$temp2+$temp1;print("收入:".sprintf("%01.2f",$temp1)."</br>支出:".sprintf("%01.2f",$temp2)."</br>收支差:".sprintf("%01.2f",$temp3));?><?phpmysql_free_result($result);mysql_close($link);?> 以上是我改过的代码,但是仍然无法向使用ODBC那样正常地显示出结果。请再帮忙检查,谢谢。 $result = mysql_query($sql) or die("Could not query: . mysql_error());少一个引号。应该是$result = mysql_query($sql) or die("Could not query:" . mysql_error()); 用过mysql_fetch_array就不需要mysql_result了.试试下面代码呢<?php$link = mysql_connect("localhost", "root", "0000") or die("Could not connect: " . mysql_error());//mysql_select_db('socooloa', $link) or die ('Can\'t use foo : ' . mysql_error());mysql_select_db("socooloa");$sql="select * from accountbook where accountbookname='流水' order by transactiondate desc;";//$result = mysql_query($sql) or die("Could not query: . mysql_error());$result = mysql_query($sql) or die("Could not query: ". mysql_error());?><table border="0" style="border-collapse: collapse" width="100%"> <tr> <td>查询时间:</td> </tr></table><meta http-equiv="Content-Language" content="zh-cn"><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td align="center">交易时间</td> <td align="center">描述</td> <td align="center">收入</td> <td align="center">支出</td> <td align="center">余额</td> <td align="center">备注</td> <td align="center">操作</td> </tr><?phpwhile($line = mysql_fetch_array($result)){?> <tr> <td align="center"><?print $line["transactiondate"];?> </td> <td align="center"><?print $line["transactiondescription"];?> </td> <td align="center"><?php $tem2=sprintf("%01.2f",$line["transactionsum"]); if($line["transactionsum"]>=0){ print($tem2); $temp1=$temp1+$tem2; } ?> </td> <td align="center"><?php if($line["transactionsum"]<0){ print($tem2); $temp2=$temp2+$tem2; } ?> </td> <td align="center"><?php $tem3=sprintf("%01.2f",$line["balance"])); print($tem3); ?> </td> <td align="center"><?print($line["otherinfo"]);?> </td> <td align="center"><?print($line["operator"]);?> </td> </tr><?php}?></table><?php$temp3=$temp2+$temp1;print("收入:".sprintf("%01.2f",$temp1)."</br>支出:".sprintf("%01.2f",$temp2)."</br>收支差:".sprintf("%01.2f",$temp3));?> 谁配置过 resin+apache+mysql 快帮忙呀!!!!!! PHP 问题 关于PHP中类的问题? 如何把一个值存为全局变量,我试用了global不行(急) 请问免费21cn邮箱:*@21cn.com的SMTP服务器是什么? 关于存储过程嵌套以及递归的问题?(PHP调用,高手请进,在线等) 请PHP高手推荐几本高阶的PHP书籍 mysql 排序问题 关于php模拟登陆 真的初学者提问,麻烦耐心仔细的回答。。。 求救!!有点难度的时间查询
$link = mysql_connect("localhost", "root", "0000") or die("Could not connect: " . mysql_error());
//mysql_select_db('socooloa', $link) or die ('Can\'t use foo : ' . mysql_error());
mysql_select_db("socooloa");$sql="select * from accountbook where accountbookname='流水' order by transactiondate desc;";
//$result = mysql_query($sql) or die("Could not query: . mysql_error());
$result = mysql_query($sql) or die("Could not query: ". mysql_error());?><table border="0" style="border-collapse: collapse" width="100%">
<tr>
<td>查询时间:</td>
</tr>
</table>
<meta http-equiv="Content-Language" content="zh-cn">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td align="center">交易时间</td>
<td align="center">描述</td>
<td align="center">收入</td>
<td align="center">支出</td>
<td align="center">余额</td>
<td align="center">备注</td>
<td align="center">操作</td>
</tr>
<?php
while($line = mysql_fetch_array($result)){
?>
<tr>
<td align="center"><?print(mysql_result($result,"transactiondate"));?> </td>
<td align="center"><?print(mysql_result($result,"transactiondescription"));?> </td>
<td align="center"><?php
$tem2=sprintf("%01.2f",mysql_result($result,"transactionsum"));
if(mysql_result($result,"transactionsum")>=0){
print($tem2);
$temp1=$temp1+$tem2;
}
?> </td>
<td align="center"><?php
if(mysql_result($result,"transactionsum")<0){
print($tem2);
$temp2=$temp2+$tem2;
}
?> </td>
<td align="center"><?php
$tem3=sprintf("%01.2f",mysql_result($result,"balance"));
print($tem3);
?> </td>
<td align="center"><?print(mysql_result($result,"otherinfo"));?> </td>
<td align="center"><?print(mysql_result($result,"operator"));?> </td>
</tr>
<?php
}
?>
</table><?php$temp3=$temp2+$temp1;
print("收入:".sprintf("%01.2f",$temp1)."</br>支出:".sprintf("%01.2f",$temp2)."</br>收支差:".sprintf("%01.2f",$temp3));?>
<?php
mysql_free_result($result);
mysql_close($link);
?>
少一个引号。应该是
$result = mysql_query($sql) or die("Could not query:" . mysql_error());
<?php
$link = mysql_connect("localhost", "root", "0000") or die("Could not connect: " . mysql_error());
//mysql_select_db('socooloa', $link) or die ('Can\'t use foo : ' . mysql_error());
mysql_select_db("socooloa");$sql="select * from accountbook where accountbookname='流水' order by transactiondate desc;";
//$result = mysql_query($sql) or die("Could not query: . mysql_error());
$result = mysql_query($sql) or die("Could not query: ". mysql_error());?><table border="0" style="border-collapse: collapse" width="100%">
<tr>
<td>查询时间:</td>
</tr>
</table>
<meta http-equiv="Content-Language" content="zh-cn">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td align="center">交易时间</td>
<td align="center">描述</td>
<td align="center">收入</td>
<td align="center">支出</td>
<td align="center">余额</td>
<td align="center">备注</td>
<td align="center">操作</td>
</tr>
<?php
while($line = mysql_fetch_array($result)){
?>
<tr>
<td align="center"><?print $line["transactiondate"];?> </td>
<td align="center"><?print $line["transactiondescription"];?> </td>
<td align="center"><?php
$tem2=sprintf("%01.2f",$line["transactionsum"]);
if($line["transactionsum"]>=0){
print($tem2);
$temp1=$temp1+$tem2;
}
?> </td>
<td align="center"><?php
if($line["transactionsum"]<0){
print($tem2);
$temp2=$temp2+$tem2;
}
?> </td>
<td align="center"><?php
$tem3=sprintf("%01.2f",$line["balance"]));
print($tem3); ?> </td>
<td align="center"><?print($line["otherinfo"]);?> </td>
<td align="center"><?print($line["operator"]);?> </td>
</tr>
<?php
}
?>
</table><?php$temp3=$temp2+$temp1;
print("收入:".sprintf("%01.2f",$temp1)."</br>支出:".sprintf("%01.2f",$temp2)."</br>收支差:".sprintf("%01.2f",$temp3));?>