How to debug MySQL "You have an error in your SQL syntax error"
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开发者_如何学C ( "bonds", "bonds", prize, p_amount, draw, d_date, held,)';
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).
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
INSERT INTO staff_service (customer_id,workorder_no,service_date,`current_date`)
VALUES (2,021,'3112-21-1',CURDATE())
If You want to use current_date as column name then put current_date between ``(back quotes)
精彩评论