morocco-iceberg Posted July 2, 2010 Share Posted July 2, 2010 I can't figure out what is going on here. When I use this in my code: $result = mysql_query("SELECT * FROM read")or die(mysql_error()); $number = mysql_numrows($result); I get this 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 'read' at line 1 Because I couldn't find anything wrong I thought I'd check if there is actually a problem, so I changed the name of the table to 'list', like this: $result = mysql_query("SELECT * FROM list")or die(mysql_error()); $number = mysql_numrows($result); And it worked fine, I recieved no error message and the rest of the code output what I expected it to. Any ideas what could be going wrong? I've checked the tables and they're fine (the list table is just a copy of the read table, so I don't see why it would be affecting the code.) Quote Link to comment https://forums.phpfreaks.com/topic/206495-nonsensical-mysql-error/ Share on other sites More sharing options...
Adam Posted July 2, 2010 Share Posted July 2, 2010 It's a reserved word in MySQL: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/206495-nonsensical-mysql-error/#findComment-1080150 Share on other sites More sharing options...
morocco-iceberg Posted July 2, 2010 Author Share Posted July 2, 2010 Aha, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/206495-nonsensical-mysql-error/#findComment-1080155 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.