You have an error in your SQL syntax; check the manual for the right syntax to use near ‘check

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.

One thought on “You have an error in your SQL syntax; check the manual for the right syntax to use near ‘check

  1. Hey, nice blog with good info. I really like coming back here often. There?s only one thing that annoys me and that is the misnifctionung of comment posting. I usually get to 500 error page, and have to do the post twice. – Content makes poor men rich; discontentment makes rich men poor. – Benjamin Franklin 1706 – 1790

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s