searls03 Posted April 21, 2011 Share Posted April 21, 2011 here is code: $query = "SELECT * FROM messages WHERE to ='$name'"; and here is the error I am getting: 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 'to ='my_name'' at line 1 Does anyone know what is happening?I think it has something to do with the where statement. Link to comment https://forums.phpfreaks.com/topic/234365-error/ Share on other sites More sharing options...
Maq Posted April 21, 2011 Share Posted April 21, 2011 'to' is a MySQL reserved word: http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html If you can, change your column names, otherwise, you must put backtics around `to` every time it's used. Link to comment https://forums.phpfreaks.com/topic/234365-error/#findComment-1204541 Share on other sites More sharing options...
Pikachu2000 Posted April 21, 2011 Share Posted April 21, 2011 MySQL reserved words Link to comment https://forums.phpfreaks.com/topic/234365-error/#findComment-1204543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.