dpp80346 2013-04-08 10:37
浏览 32

显示警告,提供的参数不是有效的[重复]

This question already has an answer here:

while performing inner join when i add data in mysql it shows a error mysql_fetch_array is not a valid argument. code is below:

    echo $sql="SELECT * FROM info
 INNER JOIN item ON info.info_id=item.info_id where item.info_id=".$info_id;
        $query=mysql_query($sql);
         while($result=mysql_fetch_array($query))
        { 
             echo "<tr>";
             echo "<td>" .$result['Name']. "</td>";
        echo "<td>" .$result['Item']. "</td>";
         echo "<td>" .$result['Price']. "</td>";
        echo "<td>" .$result['info_id']. "</td>";
             echo "<td><a href='item.php?act=edit&id=".$result['id']."'>Edit</a></td>";
             echo "<td><a href='item.php?act=delete&id=".$result['id']."'>Delete</a></td>";
             echo "<td><a href='item.php?act=item&id=".$result['id']."'>Item</a></td>";
echo "</tr>";

while running the above code it shows the following warning:

warning:mysql_fetch_array(): supplied argument is not a valid MySQL result resourc

</div>
  • 写回答

1条回答 默认 最新

  • douyang5943 2013-04-08 10:48
    关注

    The mysql_query method probably fails silently. If it does, it returns FALSE so you should be doing this:

    $query=mysql_query($sql);
    if (!$query) {
        die('MSSQL error: ' . mssql_get_last_message());
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入