我想在PHP中創建一些基本的插入查詢,它不斷地拖出我一個錯誤,但我真的不知道爲什麼,請問你們有沒有什麼不對?在簡單插入查詢中的語法錯誤
mysql_query("
INSERT INTO itens (nome, data, cliente, link, desc, img) VALUES ($nome,$data,$cliente,$link,$desc,$img)
") or die(mysql_error());
更新
從OP的刪除答案拉出時,代碼現在:
mysql_query("INSERT INTO itens (nome, data, cliente, link, `desc`, img)
VALUES ($nome,$data,$cliente,$link,$desc,$img)") or die(mysql_error());
和錯誤是:
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 'kl,j)' at line 2
吉隆坡和j是我在表格中插入的最後兩件事情。
表名是真的'itens'還是'items'? – Havelock
永不說「它給出了一個錯誤」。總是說「它給*這個*錯誤」,然後粘貼實際的錯誤。 –
抱歉,錯誤是:您的SQL語法有錯誤;檢查對應於您的MySQL服務器版本的手冊,以在'desc,img'附近使用正確的語法VALUES(s,2012-12-18,(nome,data,cliente,link,desc,img),http:// ww'在第1行 – SaraVieira