fugix Posted April 30, 2011 Share Posted April 30, 2011 can someone enlighten me as to what is wrong with this snippet $message_sql = "select * from messages where to_id=$id and read='no'"; $message_query = mysql_query($message_sql); $message_num_rows = mysql_num_rows($message_query); i get this error PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given what its basically telling me is that the "read" filed doesnt exist..because when I take it out of my query, the query works fine...however I do have a "read" field in my db with value of "no" stored in it..so im not sure why its telling me that it doesnt exist.. Quote Link to comment https://forums.phpfreaks.com/topic/235143-mysql_error/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 30, 2011 Share Posted April 30, 2011 If you search for that error message, you will find that it generally means that your query failed due to an error of some kind and you would use mysql_error() to find out why. Quote Link to comment https://forums.phpfreaks.com/topic/235143-mysql_error/#findComment-1208465 Share on other sites More sharing options...
PFMaBiSmAd Posted April 30, 2011 Share Posted April 30, 2011 Once you use some error checking to find out at what point the query contains an error, you will find that using read as a column name is the problem. See this information - http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/235143-mysql_error/#findComment-1208469 Share on other sites More sharing options...
fugix Posted April 30, 2011 Author Share Posted April 30, 2011 ahh, read is a built in function...didnt know that....thank you so much for your help! Quote Link to comment https://forums.phpfreaks.com/topic/235143-mysql_error/#findComment-1208471 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.