ShoeLace1291 Posted March 27, 2010 Share Posted March 27, 2010 I'm making a restaurant menu system with PHP and I'm storing the dishes(or items or w/e) with a database table. I need to be able to store the price of the dish. Ex 3.99 What's the best column type to use for this? It needs to be able to go up to 100.00. I tried float and inserted a sample with the price of 3.65, but after i clicked submit to execute the query, it was automatically rounded up to 4 even. Quote Link to comment https://forums.phpfreaks.com/topic/196726-storing-prices-in-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 27, 2010 Share Posted March 27, 2010 You should use a DECIMAL data type. it was automatically rounded upNot if the definition was correct. You would need to post the definition you used if you want help with it. Quote Link to comment https://forums.phpfreaks.com/topic/196726-storing-prices-in-mysql/#findComment-1032792 Share on other sites More sharing options...
ShoeLace1291 Posted March 27, 2010 Author Share Posted March 27, 2010 Quote Link to comment https://forums.phpfreaks.com/topic/196726-storing-prices-in-mysql/#findComment-1032795 Share on other sites More sharing options...
fenway Posted March 27, 2010 Share Posted March 27, 2010 You likely mean DECIMAL(10,2) -- no price has just one decimal place. Quote Link to comment https://forums.phpfreaks.com/topic/196726-storing-prices-in-mysql/#findComment-1032839 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.