>  기사  >  백엔드 개발  >  为何总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul

为何总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul

WBOY
WBOY원래의
2016-06-13 12:52:03719검색

为什么总是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul
为什么总是

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是另外一张表那得采用连接查询或者是多表符合查询
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.