Sum of values in a while-loop
Posted: Sun Mar 06, 2005 3:39 am
Hi
Could someone help me out. How can i get a sum of certain values in a while-loop. I pull out the values from MySQL and then loop thru values and print them.
here's the loop:
then i print the values. Now i need to get a sum of all values in one field. Like if you had a shopping cart displayed, where all values are listed in rows and below them is the total. I need tho do this with php, not in SQL statement.
Could someone help me out. How can i get a sum of certain values in a while-loop. I pull out the values from MySQL and then loop thru values and print them.
here's the loop:
Code: Select all
if(isset($_GETї'getResults'])) {
echo "<p>Found <b>".$totalRows_getReport."</b> rows.</p>";
if($totalRows_getReport > '0') {
while($row_getReport = mysql_fetch_assoc($getReport)) {