douzhang8033 2012-10-16 10:50
浏览 32
已采纳

PHP MYSQL脚本错误[关闭]

please help to find a a mistake: The result is the Query is empty! I do not where the problem might come, actually I know that something might be wrong mysql_querry:

<?php
include("connect.php");
?>
<?php
$result = mysql_query("SELECT PEOPLE.ID AS ID, 
                            PEOPLE.NAME AS NAME, 
                            TICKETS.TICKETID AS TICKET_NO, 
                            RECEIPTS.DATENEW AS TICKET_DATE, 
                            PAYMENTS.TOTAL AS MONEY, 
                            CUSTOMERS.NAME AS CUSTOMER, 
                            PAYMENTS.PAYMENT AS PAYMENT
        FROM PEOPLE, RECEIPTS 
        INNER JOIN TICKETS ON RECEIPTS.ID = TICKETS.ID 
        INNER JOIN PAYMENTS ON RECEIPTS.ID = PAYMENTS.RECEIPT
        INNER JOIN CUSTOMERS ON TICKETS.CUSTOMER = CUSTOMERS.ID
        WHERE TICKETS.PERSON = '.$ID.'");
if ($num > 0 ) {
$i=0;
while ($i < $num) {
        $ID = stripslashes(mysql_result($result,$i,"ID"));
        $ID = stripslashes(mysql_result($result,$i,"ID"));
        $NAME = stripslashes(mysql_result($result,$i,"NAME"));
        $TICKET_NO = stripslashes(mysql_result($result,$i,"TICKET_NO"));
        $TICKET_DATE = stripslashes(mysql_result($result,$i,"TICKET_DATE"));
        $MONEY = stripslashes(mysql_result($result,$i,"MONEY"));
        $CUSTOMER = stripslashes(mysql_result($result,$i,"CUSTOMER"));
        $PAYMENT = stripslashes(mysql_result($result,$i,"PAYMENT"));

    $row .= '<tr>
    <td><a href="update.php?ID='.$ID.'">'.$ID.'</a></td>
    <td><a href="update.php?NAME='.$NAME.'">'.$NAME.'</a></td>
    <td><a href="update.php?TICKET_NO='.$TICKET_NO.'">'.$TICKET_NO.'</a></td>
    <td><a href="update.php?TICKET_DATE='.$TICKET_DATE.'">'.$TICKET_DATE.'</a></td>
    <td><a href="update.php?MONEY='.$MONEY.'">'.$MONEY.'</a></td>
    <td><a href="update.php?CUSTOMER='.$CUSTOMER.'">'.$CUSTOMER.'</a></td>
    <td><a href="update.php?PAYMENT='.$PAYMENT.'">'.$PAYMENT.'</a></td>
    <td><a href="delete.php?ID='.$ID.'">Delete</a></td>
    </tr>';

++$i; }} else { $row = '<tr><td colspan="2" align="center">Nothing found</td></tr>'; 
}

mysql_close();
?>
<table border="1" cellpadding="3" cellspacing="0"><? echo $row ?></table>

I much appreciete your support!

  • 写回答

1条回答 默认 最新

  • doupao2277 2012-10-16 10:55
    关注

    $ID value is empty you must assign value in it.

    Secondly, you're checking $num>0 where but what is the value of $num?

    From my point of view your are trying to get the count of rows fetch.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来