Heim >Backend-Entwicklung >PHP-Tutorial > Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result res,该怎么解决
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result res
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/www/web/vipcha.net_aFKgRRM1uWJpHqxlIBez/wwwroot/cy/view.php on line 9
require_once("checkpostandget.php");
require_once("global.php");
//$ID=intval($_GET['id']);
$iD = intval(base64_decode($_GET['iD']));
$query="select * from chengyu where ID =".$ID."";
$result=mysql_query($query);
while ($rs = mysql_fetch_object($result)){
?>
while ($rs = mysql_fetch_object($result)){ //第9行
------解决方案--------------------
ID、iD、id。。先把变量名称的大小写都写对了再说。
------解决方案--------------------
$query="select * from chengyu where ID =".$ID.""; 中
$ID 没有值
------解决方案--------------------
很明显是mysql_query没有值,mysql_query没有值,有可能是$query语句有错误。$query没有错误,说明$ID不正确。