Jump to content

[SOLVED] Best way to Count


JSHINER

Recommended Posts

hmm... try this:

<?PHP
$SQL = "SELECT * FROM `table`;";
$Q = mysql_query($SQL);
if($Q){
$i = 0;
while($views = mysql_fetch_assoc){
 $num[$i] = $views['views'];
 $i++;
}
$total = count($num);
$i = 0;
$outcome = 0;
while($i < $total){
 $outcome = $num[$i] + $outcome;
}
echo($outcome);
}else{
echo('NOTHING TO SHOW');
}
?>

 

there is probably an easier way to do it, but thats the way i'd do it.

 

hope it helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.