DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   Loop Problem,plz help (http://www.daniweb.com/forums/thread65250.html)

cty Dec 18th, 2006 10:36 am
Loop Problem,plz help
 
$totalCost=0;
while($row = $result->fetch_assoc())
{
$totalCost+=$row["price"];
------------------------------
--->why the $totalCost always is 0?

UrbanSky Dec 18th, 2006 3:01 pm
Re: Loop Problem,plz help
 
does row["price"] have a value in it? Php let you assign empty array items. Try add echo $row['price'] to the loop and make sure that it is not empty.


All times are GMT -4. The time now is 2:45 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC