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 Quote 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()); Quote 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 Quote 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()); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.