cty Posted December 18, 2006 Share Posted December 18, 2006 $totalCost=0;while($row = $result->fetch_assoc()){$totalCost+=$row["price"];----------------------------why $totalCost =0?what happen? Quote Link to comment Share on other sites More sharing options...
Orio Posted December 18, 2006 Share Posted December 18, 2006 Are you sure you got a column caleed "price"?Because your syntax and logic is correct, you must have something wrong- a variable or a column name that doesnt fit.Orio. Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted December 18, 2006 Share Posted December 18, 2006 Use single quotes...[code=php:0]$totalCost+=$row['price'];[/code] RegardsHuggie 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.