hopefully simple data type question.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
aravona
Forum Contributor
Posts: 347
Joined: Sat Jun 13, 2009 3:59 pm
Location: England

hopefully simple data type question.

Post by aravona »

Ok this is bugging me and I think its probably the easiest thing in the world to answer.

I have a database which uses floats for prices, because it needs decimals > however with phpmyadmin it doesnt keep .00 or .10 the latter becoming .1 however this doesnt look good at all. The prices were originally varchars but that made the prices not order properly.

Anyone know how I get the .00 back?

Thanks

Aravona
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: hopefully simple data type question.

Post by JakeJ »

You don't store .00 or .10 or whatever.

When displaying your data just use number_format($num, 2)
Post Reply