Page 1 of 1
How to display INT from MySQL to 1,000.00 format?
Posted: Tue Aug 19, 2008 11:54 pm
by zplits
greetings to everyone.
does anyone know how to format INT variables from MySQL and display it in a page as the following format.
Example.
in my database:
field name: balance
data type: int
value: 1000
how can i format it so that i can display it in the page as P 1,000.00 ?
note: P stands for philippines peso.
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:08 am
by nowaydown1
Have a look at either:
http://us3.php.net/number_format
http://us3.php.net/money_format (If you aren't on Windows)
There's also stuff like FORMAT if you prefer to do it on the DB side:
http://dev.mysql.com/doc/refman/5.0/en/ ... ion_format
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:13 am
by zplits
Thanks for the response. If i use the MySql side. Can i get it and display it as 1,000.00 in my page?
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:18 am
by nowaydown1
Yes, if you do it on the DB side, the raw result you get back from your query will be the formatted version (1,000.00).
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:19 am
by zplits
ok then, What data type should i use? INT?double? or decimal?
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:32 am
by Christopher
Re: How to display INT from MySQL to 1,000.00 format?
Posted: Wed Aug 20, 2008 12:36 am
by zplits
I think it's best to use DECIMAL.