1

I have following table setup.

+-------------+---------+------+-----+---------+----------------+
| Field       | Type    | Null | Key | Default | Extra          |
+-------------+---------+------+-----+---------+----------------+
| id          | int(11) | NO   | PRI | NULL    | auto_increment |
| date        | date    | YES  |     | NULL    |                |
| limit       | int(11) | YES  |     | NULL    |                |
| contract_id | int(11) | YES  |     | NULL    |                |
+-------------+---------+------+-----+---------+----------------+

And this insert query

INSERT INTO userlimit (date, limit, contract_id) VALUES (now(), 10, 1);

Always when I want to execute it I receive following error

ERROR 1064 (42000): 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 'limit, contract_id) VALUES (now(), 10, 1)' at line 1

My syntax looks perfectly fine to me. Why do I get this Error?

BoJack Horseman
  • 4,406
  • 13
  • 38
  • 70

1 Answers1

2

You need to quote field names with backticks

INSERT INTO userlimit (`date`, `limit`, `contract_id`) VALUES (now(), 10, 1)
Ivan Solntsev
  • 2,081
  • 2
  • 31
  • 40