ok... I am not sure if this is the best way to go about doing it,...but I am working from someone elses code handed off to me. I have a loop giving me a count of items from a DB, It is giving me the top 10 records and their count. e.x Tim - 30 Mike - 50 Denise - 44 How can I essentially, count, a count? e.x. $total = 30 + 50 + 44 This is what I currently have: <?php while ($rowData= mysql_fetch_array($resultData)){ echo number_format($rowData['count']); } ?> I tried: $total[0] = number_format($rowData['count']); echo $total outside the loop but no dice... Im stuck! Thanks for your help. -Tim
<?php $total = 0; while ($rowData= mysql_fetch_array($resultData)){ $total += $rowData['count']; echo number_format($rowData['count']); } echo number_format($total); ?> PHP: