bobby317 Posted June 30, 2010 Share Posted June 30, 2010 I was wondering what is the proper way to store prices in a database example 15.98. Also if anyone can recomend any site to read up on this would be great to thanks. Quote Link to comment https://forums.phpfreaks.com/topic/206302-best-way-to-store-prices-in-database/ Share on other sites More sharing options...
ejaboneta Posted June 30, 2010 Share Posted June 30, 2010 I'd use a column type 'DECIMAL( 10, 2 ) UNSIGNED'. Its a number type that will allow you to include cents. Unsigned because unless you want to pay the customer to take your products, your prices will probably always be positive values($4.99, not $-4.99). But I'm not an expert so yea... This is just what I've picked up. Quote Link to comment https://forums.phpfreaks.com/topic/206302-best-way-to-store-prices-in-database/#findComment-1079306 Share on other sites More sharing options...
fenway Posted July 1, 2010 Share Posted July 1, 2010 That's the correct choice Quote Link to comment https://forums.phpfreaks.com/topic/206302-best-way-to-store-prices-in-database/#findComment-1079754 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.