我想在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