Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL resultmysql_fetch_assoc很奇怪
好吧,这是我的代码。
<?php
include 'connect.php';
$id = addslashes($_REQUEST['id']);
$image = "SELECT * FROM images WHERE id=$id";
$result = mysql_query($image);
$imagearray = mysql_fetch_assoc($result);
$realimage = $imagearray['image'];
header("Content-type: image/jpeg");
echo $realimage;
?>
页面使用GET来获取ID,但随后它给了我这个错误:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a6289454/public_html/get.php on line 9
也许是因为你的查询没有返回结果/记录 – 2012-02-11 23:47:18
@MuhammadAbrar即使是一个空表,也会从'mysql_query'返回一个有效的资源(这会导致'mysql_fetch_assoc'返回false)。该错误可能在查询中。 – 2012-02-12 00:11:38