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? Link to comment https://forums.phpfreaks.com/topic/31113-loop-problemplz-help/ 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. Link to comment https://forums.phpfreaks.com/topic/31113-loop-problemplz-help/#findComment-143661 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 Link to comment https://forums.phpfreaks.com/topic/31113-loop-problemplz-help/#findComment-143664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.