I was working with an SQL syntax today and found an error which was like :
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 ‘check) VALUES (‘YES’)’ at line 1
I was trying again and again checking DB connection and fixing other things but the error were not being resolved. I was using very simple SQL query which was like the following :
$query = "INSERT INTO test1(check) VALUES ('YES')";
so what was my mistake? I later realized, it is about RESERVED WORDS of mysql. CHECK is a word which is reserved by MySQL. I used CHECK as a column name of my Table, which was causing the error.
If you have similar errors, Have a look of MySQL RESERVED WORD list from this link.