I have never seen this problem. I want to make a MySQL query (insert, update, select) but MySQL gives an error.
My query:
SELECT * FROM option
and error:
[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 'option' at line 1]
but if i put ``
SELECT * FROM `option`
it's working. What can i do?
option
is reserved word for MySQL you need to enclose it with backticks or avoid it by changing table name
SELECT * FROM `option`
Option
is a reserved keyword in MySQL (SQL).
So, after using backtick (`), it is not considered as keyword.
You need to use backtick for option, Since it is a reverse word. Try this:
SELECT * FROM `option`;
Refer: http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-5.html
option is a keyword check it here http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html use backtick for option select * from 'option'