Page 1 of 1

[SOLVED] Curreny Representation

Posted: Mon Sep 05, 2005 9:01 am
by lisamarie_tt
Description of the task:
I would like to insert into a database a currency value from a form or retrive from a data a numeric (float) value and represent it as currency.

Description of the problem:
The insertion is being done, however the values from the from are not being inserted in true float (decimal) form. Example if the from submits:
11.00 dollars --->> 11 is stored
11.50 dollars --->> 11.5 is stored
11.75 dollars --->> 11.75 is stored


When the sorted values are accessed from the database they do not conform to the expected currency format (00.00).

Main Concerns and questions:
1.) Is there a way to store or specifiy to php to take trailing zeros.
2.) Is there a way to format retrived values a curreny.

Posted: Mon Sep 05, 2005 9:06 am
by lisamarie_tt
Got it !!!

I'm using the number_format method to format the number in the form: 0,000.00

Pays to read the PHP Manual.

Posted: Mon Sep 05, 2005 9:54 am
by patrikG
lisamarie_tt wrote:Pays to read the PHP Manual.
8)