Danny159
08-06-2008, 02:00 PM
Hey,
I have been doing this for ages! and its annoying me... Can someone please help...
here is my code
<?php
$result = mysql_query("SELECT * FROM projects");
while($rows = mysql_fetch_array($result)){
$price = $rows["price"];
$exp = "$price:";
$for = explode(':', $exp, -1);
foreach($for as $key);
$add_up = ceil($key + $key);
echo "$key";
}
?>
All I want it to do is add up all the $price's so say in to database it had
0.55
558.00
2.00
it would echo "560.55"
but I cant get it to add them...
the above code echos "0.00250.00555.441587.0035.50"
Help would be grate...
Danny
I have been doing this for ages! and its annoying me... Can someone please help...
here is my code
<?php
$result = mysql_query("SELECT * FROM projects");
while($rows = mysql_fetch_array($result)){
$price = $rows["price"];
$exp = "$price:";
$for = explode(':', $exp, -1);
foreach($for as $key);
$add_up = ceil($key + $key);
echo "$key";
}
?>
All I want it to do is add up all the $price's so say in to database it had
0.55
558.00
2.00
it would echo "560.55"
but I cant get it to add them...
the above code echos "0.00250.00555.441587.0035.50"
Help would be grate...
Danny
