Home >Backend Development >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,该怎么解决

WBOY
WBOYOriginal
2016-06-13 13:41:581336browse

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不正确。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn