Parse error: parse error, unexpected T_LNUMBER in D:\oa\test.php on line 19

解决方案 »

  1.   

    $result = mysql_query($sql) or die("Could not query: ". mysql_error());
      

  2.   

    <?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);
    ?>
      

  3.   

    以上是我改过的代码,但是仍然无法向使用ODBC那样正常地显示出结果。请再帮忙检查,谢谢。
      

  4.   

    $result = mysql_query($sql) or die("Could not query: . mysql_error());
    少一个引号。应该是
    $result = mysql_query($sql) or die("Could not query:" . mysql_error());
      

  5.   

    用过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>
    <?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));?>