mickwaffle Posted July 24, 2009 Share Posted July 24, 2009 :'( what is wrong with the following mysql_query("SELECT * FROM advert_notices WHERE owner_uuid='$owner_uuid' AND read='0' AND view='1'") it says there is an error in my SQL Link to comment https://forums.phpfreaks.com/topic/167281-why-wont-my-sql-work/ Share on other sites More sharing options...
rhodesa Posted July 24, 2009 Share Posted July 24, 2009 what is the error? mysql_query("SELECT * FROM advert_notices WHERE owner_uuid='$owner_uuid' AND read='0' AND view='1'") or die mysql_error()); Link to comment https://forums.phpfreaks.com/topic/167281-why-wont-my-sql-work/#findComment-882035 Share on other sites More sharing options...
mickwaffle Posted July 24, 2009 Author Share Posted July 24, 2009 O ye.. sorry.. i actually had that error line in.. just forgot to put it here.. anyway error is : 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='0' AND view='1'' at line 1 Link to comment https://forums.phpfreaks.com/topic/167281-why-wont-my-sql-work/#findComment-882046 Share on other sites More sharing options...
rhodesa Posted July 24, 2009 Share Posted July 24, 2009 READ is a reserved word in MySQL: http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html I highly recommend changing the name of that column...but if you are beyond the point of no return, you can use backticks: mysql_query("SELECT * FROM advert_notices WHERE owner_uuid='$owner_uuid' AND `read`='0' AND view='1'") or die mysql_error()); Link to comment https://forums.phpfreaks.com/topic/167281-why-wont-my-sql-work/#findComment-882052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.