0");
?>
Super Mario's Fruits, Thank you
You have ordered:
Fruit | Quantity | Price | Total |
$qty)
if ($fruit != 'who' && $qty > 0)
{ pg_query_params("insert into sold values ($1,$2)", array($fruit,$qty))
or die ("yes, we have no $fruit, sorry.");
// oops, need to look up price
$priceresult = pg_query_params("select price::numeric from fruit where name=$1", array($fruit));
$price = pg_fetch_result ($priceresult,0,0);
$total = $price*$qty;
$sum += $total;
// price is now MONEY
print "$fruit | $qty | $price | $total |
\n";
}
pg_query("commit");
$sum = number_format($sum,2);
print "Total for all | $ $sum |
\n";
?>