Etherwood Posted November 16, 2009 Share Posted November 16, 2009 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 '= testdb' at line 1 $query=mysql_query("select * from users where database = '$database'") or die(mysql_error()); PHP 5.2.9 MYSQL 5.0.77 Link to comment https://forums.phpfreaks.com/topic/181688-solved-mysql-syntax-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 16, 2009 Share Posted November 16, 2009 As you can imagine, the word database probably has significance to a database - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html If you truly have a column named database, you must enclose it in back-ticks ` so that it will be treated as an identifier instead of a reserved keyword. Link to comment https://forums.phpfreaks.com/topic/181688-solved-mysql-syntax-error/#findComment-958279 Share on other sites More sharing options...
Etherwood Posted November 16, 2009 Author Share Posted November 16, 2009 Ah, I didn't know about that, I do now. Thanks Link to comment https://forums.phpfreaks.com/topic/181688-solved-mysql-syntax-error/#findComment-958283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.