Im just curious as to how one would approach adding up a column that is dynamically built from the database..
Each loop passes a price and I can't figure out how to collect each price to get the total price..
Im just curious as to how one would approach adding up a column that is dynamically built from the database..
Each loop passes a price and I can't figure out how to collect each price to get the total price..
Initialize a variable. Then increment the variable by the value in the cell:
<?php
$price='';
for($i=0; $i<5; $i++){
$price +=$i;
}
echo "Price=$price";// will output Price=10
?>
Thank you sir!
No problem.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.