Hi all, Not sure if this is possible so need to ask. I want to store numbers in a MySQL DB but in the format of 130.000 but the DB keeps knocking off the .000 as it's seeing the number as a decimal but I don't want it to, is there a way around this that you may know of? Ta JP
The only way you could do it is to store them as strings, though must admit I can't imagine a reason why you'd want to. If it's for display purposes just format the text in your server side code.
I normally use a double datatype when storing something like that. Use something like this when creating the table: CREATE TABLE `products` ( `price` double(10,2) default NULL) -Erik
Try this http://mysqld.active-venture.com/Numeric_types.html It shows you how to preserve decimal places.
Yes you can. What woodside says. decimal(15,4) is what I use for prices ex VAT with 4 decimals. 1 Pound item is saved as 1.0000 Copy Paste from PHPMyAdmin: products_price decimal(15,4) No 0.0000
i don't understand y u'd wanna waste unecessary space in ya DB with trailing zero's. As DCT say's, store it as an int or woteva and use formatting on output!