mysql_fetch_assoc():提供的参数不是PHP中的有效MySQL结果资源 [英] mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in php
问题描述
Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
$query = "SELECT UniqueID FROM configuration";
$result = mysql_query($query)or die(mysql_error());;
while($row = mysql_fetch_assoc($result)) { }
将异常作为
警告:
mysql_fetch_assoc()
:在第10行的C:\ Program Files \ Apache Group \ Apache2 \ htdocs \ ehp \ hello.php中,提供的参数不是有效的MySQL结果资源
Warning:
mysql_fetch_assoc()
: supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\ehp\hello.php on line 10
推荐答案
这有点令人困惑,因为这种事情通常是由SQL错误引起的,但是..or die(mysql_error());
行应该已经解决了.检查循环的内容,确认您没有覆盖$result
变量.
That's slightly confusing, since this sort of thing is usually caused by an SQL error, however the line ..or die(mysql_error());
should have picked that up. Check the contents of your loop that you're not overwriting the $result
variable.
这篇关于mysql_fetch_assoc():提供的参数不是PHP中的有效MySQL结果资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!