我快疯了,我想在 stuff tabale 中插入一个值,但我得到了这个错误
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 'name,describe,price,picname) values ('dfg','dfgdf','2','hr')' at line 1
我的代码是:
mysql_query("insert into stuff(name,describe,price,picname) values ('dfg','dfgdf','2','hr')") or die("cannot execute the query" .mysql_error());
我能做什么?它浪费了我 1 小时的工作! 谢谢
最佳答案
mysql_query("insert into stuff (`name`,`describe`,`price`,`picname`) values ('dfg','dfgdf','2','hr')") or die("cannot execute the query" .mysql_error());
因为 describe
是保留字,所以请用反引号括起您的列名。
关于php - 您的 SQL 语法有误;检查对应的手册等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9145561/