Re: Basic question about adding numbers from DB




possibleas@xxxxxxxxx wrote:
Hi, I have some prices stored in a table, and after retrieving records
like,

2.50
1.70
3.25
4.25

I add them together with something like,

<?php for ($x = 0; $x < sizeof($prices); $x++) {
$total=$total+$prices[$x]; }?>

But, when I print $total, if the amounts add up to an even number like
11.70, it prints out like 11.7

How do I get this to express any zeros at the end? Best regards, Amy

<http://www.php.net/number_format>
<http://www.php.net/money_format>

.



Relevant Pages

  • Basic question about adding numbers from DB
    ... Hi, I have some prices stored in a table, and after retrieving records ... How do I get this to express any zeros at the end? ... Best regards, Amy ...
    (alt.php)
  • Re: Help!
    ... > I use Turnpike and only keep news for 3 days. ... > accumulate in the file but I doubt this amounts to much. ...
    (uk.business.agriculture)
  • RE: extra results in the MAX function
    ... where A holds the months and B the amounts ... Regards, ... Peo Sjoblom ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Highest three numbers in a list
    ... entered with ctrl + shift & enter ... Regards, ... Peo Sjoblom ... >I need the average of the highest three amounts in a range. ...
    (microsoft.public.excel.misc)
  • Re: Ping Chip Pearson
    ... Biff ... > Ashish Mathur ... >> amounts. ...
    (microsoft.public.excel.worksheet.functions)