0

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,)';
1
  • Also consider that you can use native sql functions if you need the current date to be automatically filled in. Just insert a null value to this field (for example "updated" i/o using the "current_date" keyword). For mysql, you just have to declare a timestamp field with "CURRENT_TIMESTAMP" as defaut value. Commented Mar 17, 2011 at 5:21

4 Answers 4

5

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

Sign up to request clarification or add additional context in comments.

Comments

4

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

1 Comment

how to debug it tho
3

try

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.