我有一個Mysql Update的奇怪問題,我不確定是什麼導致它。我懷疑表本身有問題,但導致錯誤的字段似乎與表中的其他字段相同。我可以在SQL選項卡和php代碼中重新創建phpMyAdmin中的錯誤。我完全難倒了。 在表中的字段定義如下:更新過程中的Mysql語法錯誤,但代碼看起來不錯
bnumber is INT length=11
bname is VARCHAR length=60 Collation=latin1_swedish_ci
twittername is VARCHAR length=15 Collation=latin1_swedish_ci
desc is VARCHAR length=60 Collation=latin1_swedish_ci
此更新語句的工作原理:
update tbl1 set bname='myName', twittername='myTweet' where bnumber=1;
這個人給我的錯誤:
update tbl1 set bname='myName', twittername='myTweet', desc='test' where bnumber=1;
我得到的錯誤是:
#1064 - 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 'desc='Main' where bnumber=1' at line 1.
我似乎沒有任何問題從表格中選擇或插入表格。只有更新是給我的錯誤。
我很感激任何幫助。
謝謝!
嘗試在'desc'附近反引號,你知道'desc'是'describe'的關鍵字和同義詞,對不對? –
desc是一個保留字。你需要逃避它。 –
@injekt:它也不是DESCENDING的同義詞嗎? – Mr47