[thelist] PHP Doubling up
Rob Wilson
robw at enigma-interactive.co.uk
Wed Aug 14 08:38:00 CDT 2002
>/* Lets get the total of products and the total cost */
>function status($cart) {
>if($cart) {
>foreach ($cart as $item => $value) {
>$number += $cart[$item][qty];
>$total += $total + ($cart[$item][qty] * $cart[$item][unit_price]);
This without the shortcuts comes out at
$total = $total + $total + ( $cart[$item][qty] * $cart[$item][unit_price]);
Since x += y is equivalent to x = x + y
This is, I would suggest, where you problem lies.
Rob
More information about the thelist
mailing list