darkfreaks Posted July 29, 2011 Share Posted July 29, 2011 for some reason it is returning false and the message flag for my script always appears disabled. example code $num_rows= mysql_num_rows($result); if($num_rows < 1) { //disable }else{ //enabled } Quote Link to comment https://forums.phpfreaks.com/topic/243216-num_rows-always-returning-false/ Share on other sites More sharing options...
Maq Posted July 29, 2011 Share Posted July 29, 2011 Show us a few lines before that, your query is most likely failing and your $result is not a resource id. Echo $num_rows, see what the value is. Quote Link to comment https://forums.phpfreaks.com/topic/243216-num_rows-always-returning-false/#findComment-1249138 Share on other sites More sharing options...
darkfreaks Posted July 29, 2011 Author Share Posted July 29, 2011 i think i found the problem i am using a session to pass the USER ID. but not sure. $m_id = $_SESSION['id']; $result = mysql_query("SELECT * FROM notifications WHERE member_id=$m_id AND status=1"); $num_rows = mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/243216-num_rows-always-returning-false/#findComment-1249145 Share on other sites More sharing options...
Maq Posted July 29, 2011 Share Posted July 29, 2011 Echo your query to make sure it's correct, particularly the $m_id, and put in or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/243216-num_rows-always-returning-false/#findComment-1249175 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.