jonniejoejonson Posted May 16, 2010 Share Posted May 16, 2010 $sql= "SELECT count(*) FROM name_table WHERE name='dave'" GROUP BY state; $sql_result=$database_object->query($sql); $sql_result = mysql_query($sql,$connection) $totalNumberOfRows=mysql_result($sql_result, 0); This works fine as long as there is at least 1 result.. how are you meant to get the result of count if the count reult is 0; Link to comment https://forums.phpfreaks.com/topic/201945-mysql_result-and-count-and-group-by/ Share on other sites More sharing options...
CodeMaster Posted May 16, 2010 Share Posted May 16, 2010 You might want to use mysql_num_rows(). Link to comment https://forums.phpfreaks.com/topic/201945-mysql_result-and-count-and-group-by/#findComment-1059092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.