spamoom Posted March 29, 2007 Share Posted March 29, 2007 I'm having problems with adding some variables... here is the code, the $itemtotal array is filled with a decimal(item price) further up in a while loop from the db <?php $total = 0; foreach ($itemtotal as $value) { $total + $value; } echo $total; ?> I get 0 as my result, even though i have printed the array and there are numbers there.... Any ideas?? Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted March 29, 2007 Share Posted March 29, 2007 [code][code] <?php $total = 0; foreach ($itemtotal as $value) { $total += $value; } echo $total; ?> or [/code] <?php $total = 0; foreach ($itemtotal as $value) { $total = $total + $value; } echo $total; ?> [/code] Quote Link to comment Share on other sites More sharing options...
spamoom Posted March 29, 2007 Author Share Posted March 29, 2007 Thank You Can't believe I didn't think of that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.