Jump to content

Archived

This topic is now archived and is closed to further replies.

nfr

Math Datatypes for Currency

Recommended Posts


Hello -

I am trying to build a small accounting system using php/mySQL. What datatypes should I use to store amounts, i.e. monetary values? Also, how can I format the amounts so that they are presented as €xx.yy and not €xx.y if the y value is 40 cents for example?

Regards,

Neil.

Share this post


Link to post
Share on other sites
This might help as regards formatting

[a href=\"http://us2.php.net/money_format\" target=\"_blank\"]http://us2.php.net/money_format[/a]

and here for data types

[a href=\"http://www.htmlite.com/mysql003.php\" target=\"_blank\"]http://www.htmlite.com/mysql003.php[/a]

Hope it helps.

Lite...

Share this post


Link to post
Share on other sites
as for datatypes in the DB, FLOAT(6,2) usually works quite well for me, but i don't typically use anything with HUGE numbers, so you may want to increase that a bit for your needs.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.