Re: [請益] Mysql Syntax Error

看板PHP作者 (我是道明柏毅)時間18年前 (2006/05/13 23:37), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《rpuppy (funny)》之銘言: : Could not run query: You have an error in your SQL syntax; check the manual : that corresponds to your MySQL server version for the right syntax to use : near 'check='1'' at line 1 : 程式碼如下: : $sql="select count(*) from $friend where check='1'"; $sql = sprintf("select count(*) from `%s` where `check` = '1'", $friend); 這樣寫 比較不會有錯誤 將來也會比較好維護 : $result=mysql_query($sql,$db); : if(!$result) { : echo 'Could not run query: ' . mysql_error(); : exit; : } : 請問是版本更新所造成的問題嗎? 懇請各位大大回答 : 謝謝各位! -- ******************************************************** * 瘋狂小惡魔分享討論區 * * http://www.forum.Wu-Boy.com/index.php * * 無名相簿-appleboy * * http://www.wretch.cc/album/appleboy * ******************************************************** -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.203.237.84

05/14 01:23, , 1F
可以正常執行了!! 感謝^^
05/14 01:23, 1F
文章代碼(AID): #14PVqZNF (PHP)
討論串 (同標題文章)
文章代碼(AID): #14PVqZNF (PHP)