1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
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 'out=0 AND invalid=0 ORDER BY id DESC' at line 1"
The term "out" is a reserved keyword under MySQL 5; In order for the query to be valid, you need to use back-quotes around the word out :
mysql> SELECT * FROM abc_xyz WHERE fgh='3' AND `out`=0 AND invalid=0 ORDER BY id DESC;
Link to this FAQ: