You are here: Re: Basic question about adding numbers from DB « All PHP « IT news, forums, messages
Re: Basic question about adding numbers from DB

Posted by ZeldorBlat on 08/28/06 02:30

possibleas@gmail.com 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>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация