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? Quote Link to comment 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] Quote Link to comment 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.