如何调试MySQL“您的SQL语法错误”

发布于 2024-10-22 23:32:50 字数 416 浏览 4 评论 0原文

这是错误

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

(り薆情海 2024-10-29 23:32:50

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).

箜明 2024-10-29 23:32:50

您不能使用 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

粉红×色少女 2024-10-29 23:32:50

尝试

INSERT INTO staff_service (customer_id,workorder_no,service_date,`current_date`) 
VALUES (2,021,'3112-21-1',CURDATE())

try

INSERT INTO staff_service (customer_id,workorder_no,service_date,`current_date`) 
VALUES (2,021,'3112-21-1',CURDATE())
烧了回忆取暖 2024-10-29 23:32:50

如果您想使用 current_date 作为列名,请将 current_date 放在``(反引号)之间

If You want to use current_date as column name then put current_date between ``(back quotes)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文