mysql_fetch_assoc(): 提供的参数在 php 中不是有效的 MySQL 结果资源 [英] mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in php

查看:21
本文介绍了mysql_fetch_assoc(): 提供的参数在 php 中不是有效的 MySQL 结果资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
警告:mysql_fetch_array():提供的参数不是有效的 MySQL 结果

$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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆