brown2005 Posted November 6, 2006 Share Posted November 6, 2006 $a = "SELECT COUNT(*) AS num FROM a;";$a_query = mysql_query($a) or die(mysql_error());while($a_array = mysql_fetch_array($a_query)){echo"$a_array[num]"; }echo"<br><br><br>";$b = "SELECT COUNT(*) AS num1 FROM a WHERE a_30days='1';";$b_query = mysql_query($b) or die(mysql_error());while($b_array = mysql_fetch_array($b_query)){echo"$b_array[num1]"; }can the above to be shortend at all or put into a function to make them easier/faster to work? Link to comment https://forums.phpfreaks.com/topic/26341-can-this-be-shortend-or-put-in-a-function/ Share on other sites More sharing options...
sasa Posted November 6, 2006 Share Posted November 6, 2006 try[code]SELECT COUNT(*) as num, SUM(a_30days='1') as num1 FROM a[/code] Link to comment https://forums.phpfreaks.com/topic/26341-can-this-be-shortend-or-put-in-a-function/#findComment-120584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.