Re: [請益]supplied argument isnot a valid MySQL …

看板PHP作者 (分手,快樂,只是朋友...)時間18年前 (2008/02/01 21:37), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
※ 引述《idcomputer (大順)》之銘言: : $sqlstr1 = "SELECT * FROM twodata ORDER BY sd ASC"; : $res1 = mysql_query($sqlstr1); : $row1 = mysql_fetch_assoc($res1); : $totalRows1 = mysql_num_rows($res1); : <==187 : $sqlstr2 = "SELECT * FROM twodata"; <==188 : $res2 = mysql_query($sqlstr2); : $row2 = mysql_fetch_assoc($res2); : $totalRows2 = mysql_num_rows($res2); : 連續送出兩次的查詢!!! : 下方的陣列有正常顯示 : 不過網頁卻出現 : Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL : result resource in C:\AppServ\www\two.php on line 187 : Warning: mysql_num_rows(): supplied argument is not a valid MySQL : result resource in C:\AppServ\www\two.php on line 188 : 想請問問題是出在?! 只取一次的時候難道就會正常嗎? 試試看把 mysql_num_rows 放在 mysql_query 的下一行.. 也就是一完成 query 完成就取得筆數... 然後才 mysql_fetch_assoc -- 我是上來領便當的... 逛 php 版, database 版只是順便而已... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.101.164
文章代碼(AID): #17eo1yug (PHP)
文章代碼(AID): #17eo1yug (PHP)