I need to โsumโ the values โโof the variables, while, here is my example:
while($row = mysql_fetch_array($result)){
$price= $row['price'] * $row['order_q'];
}
The above code throws if I put echo $price;, for example:
19 15 20 13 10
I need something like: sum($price)or array_sum($price)to count all the results of a while loop. So I want to count:19+15+20+13+10 = 77
How can I do this with php?
thank
source
share