如何调试MySQL“您的SQL语法错误”
这是错误
Could not enter data: 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 ')' at line 1
这是我的查询
$sql = 'INSERT INTO list '.
'(bond_amount,bond,prize,prize_amount,draw,draw_date,held_at) '.
'VALUES ( "bonds", "bonds", prize, p_amount, draw, d_date, held,)';
This is the error
Could not enter data: 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 ')' at line 1
This is my query
$sql = 'INSERT INTO list '.
'(bond_amount,bond,prize,prize_amount,draw,draw_date,held_at) '.
'VALUES ( "bonds", "bonds", prize, p_amount, draw, d_date, held,)';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
current_date
是mysql中的保留字。您应该避免使用它,但如果您确实想要使用它,则必须引用它(用反引号)。current_date
is a reserved word in mysql. You should avoid it, but if you really want to use it, you must quote it (in back-quotes).您不能使用
current_date
作为列名称。它是mysql的保留字。http://dev.mysql.com/doc/refman/5.5 /en/reserved-words.html
You can not use
current_date
as column name. It is a reserve words of mysql.http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
尝试
try
如果您想使用 current_date 作为列名,请将 current_date 放在``(反引号)之间
If You want to use current_date as column name then put current_date between ``(back quotes)