RE: [PHP] Math question

From: Date: Tue, 27 May 2003 03:09:24 +0000
Subject: RE: [PHP] Math question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149039@lists.php.net to get a copy of this message
> I'm working on a little shopping cart script and when I get to the > checkout portion I show what is in the cart and for each item I show the > quanity, price per unit then I show the total cost for that item. So > basically it looks like $total = $qty * $price My question is how do I Where you have that line, just after it put: $grand_total += $total; Then print $grand_total at the end of your loop. > add the value of $total to give the over total of the order? Since there > may be one or more different items in the cart I can't seem to pin down > the math that will allow for the changing amount of items in the cart. > since there may be just one $total variable or 5. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#149039) next »