dqkmn26444 2010-12-22 23:42
浏览 26
已采纳

如何输出JOINed表? [重复]

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

$id=(int)$_GET["id"];

$result = mysql_query("SELECT       questionstable.*, categorytable.name
FROM         questionstable
  INNER JOIN categorytable
  ON         categorytable.id = questionstable.category
WHERE        id=$id");
$row = mysql_fetch_assoc($result);

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Program Files\EasyPHP-5.3.4.0\www\scsoru.php on line 33

  • 写回答

3条回答 默认 最新

  • download1323 2010-12-22 23:44
    关注

    mysql_query returns false on failure, so the fact that you're getting a boolean means the query was unsuccessful. You should always check to see if the result was false before going any further (see the above link for more details).

    Try running the SQL query in PHPMyAdmin to see what the error is. I'm guessing it's because you're using WHERE id when you should be using WHERE questionstable.id.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类