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 } 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. 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); 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()); 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
Archived
This topic is now archived and is closed to further replies.