為什麼總是Warning: mysql_fetch_object(): supplied argument is not a valid MySQL resul

來源:互聯網
上載者:User
為什麼總是

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是另外一張表那得採用串連查詢或者是多表符合查詢

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.