为什么总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul
程序员文章站
2022-04-22 20:22:15
...
为什么总是
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in D:\AppServ1\www\forum\index.php on line 46
代码:
$id = $row["id"];
$res=mysql_query("select count(*) as total from reply where topic id='$id'");
$r = mysql_fetch_object($res);
大家帮帮忙
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in D:\AppServ1\www\forum\index.php on line 46
代码:
$id = $row["id"];
$res=mysql_query("select count(*) as total from reply where topic id='$id'");
$r = mysql_fetch_object($res);
大家帮帮忙
回复讨论(解决方案)
topic id='$id'" //这里错了吧
怎么改呢?。。。。。
你把SQL语句放到MYSQL里面运行,看有没有结果
最后的$id用连字符拼接吧,别直接写到sql里
表结构和需求都不贴出来,怎么改只有你自己知道。
topic 什么东西
$res = mysql_query("select count(*) as total from reply where id=".$id);
topic是另外一张表
topic是另外一张表那得采用连接查询或者是多表符合查询
上一篇: 初学者表单提交有关问题!1
推荐阅读
-
为何总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul
-
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result res,该怎么解决
-
php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result解决办法
-
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resour,该怎么解决
-
为什么总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul
-
php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result解决办法
-
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resour,该怎么解决
-
Warning: mysql_free_result(): supplied argument is not a valid MySQL result
-
总是出现mysql_fetch_array(): supplied argument is not a valid MySQL result resource
-
【进去请严肃】从mysql取数据时提示Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result