this may sound lame but i am stuck up with summing up the values retrieved from mysql. i want to sum up the grand total of the sales invoice items that is retrieved from mysql database. following is the code for sub total for each line which is fine.
while($row = mysql_fetch_array($qry)){
echo $row['b'] * $row['c'];
}
'b' is the quantity and 'c' is the price.all these values are retrieved from mysql and the no of rows is variable and all this is inside the while loop. Now outside of the while loop, the last row, i want the grand total. can somebody point me in the right direction. i tried
echo SUM($row['b'] * $row['c']);
but this doesn't work and gives an error. i am sure i am doing it wrongly.