Jump to content

Keeping .00 On Data.


shadowayex

Recommended Posts

I have a field set to the data type FLOAT so I can have decimals in it. When I put something with .00 on the end (6.00, for example), it automatically cuts off the .00. I understand why it does this, but I was wondering if there's a way to make it not do that.

Link to comment
Share on other sites

try only selecting the one field from the table

mysql_query("SELECT FORMAT(balance, 2) FROM accounts ORDER BY name ASC");

Notice that the '*' selector is missing?You might need to specify the particular field you want selected.

Link to comment
Share on other sites

I tried it and the query fails:mysql_query("SELECT FORMAT(balance, 2) * FROM accounts ORDER BY name ASC");The query works without the FORMAT(balance, 2).
You have to put commas between the columns that you want returned. This query:
SELECT FORMAT(balance, 2) * FROM accounts ORDER BY name ASC

is going to fail just like this would:

SELECT balance name FROM accounts ORDER BY name ASC

Try this:

SELECT FORMAT(balance, 2), * FROM accounts ORDER BY name ASC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...