Entering A price
What would be the best way to set my SQL field for a value such as $34,000.
My SQL is: price DECIMAL(4,2)
and it seems I can only output 34.00. How could I also make it s开发者_C百科how with a , not a . (could possibly be to due my cms stripping data)
For $34,000 you need DECIMAL(7,2), five digits before the decimal point, two after.
And think about if you really need to be so restrictive. Two decimals after the point makes sense, but you want to err on the safe side with the total number, otherwise you cannot store say, $1,000,000, in your database.
精彩评论