Woodburn2006 Posted November 21, 2007 Share Posted November 21, 2007 i am storing lap times in a DB using a PHP based form. if i enter the number 32.45 in the form and send it to the DB it only stores it as 32, but when i manually enter it usng PHP myadmin it works fine. i have the column format set as 'float' and have tried decimal, what is the best format to use? Quote Link to comment https://forums.phpfreaks.com/topic/78252-storing-a-decimal-number/ Share on other sites More sharing options...
fenway Posted November 21, 2007 Share Posted November 21, 2007 You definitely don't want FLOAT... use DECIMAL. Quote Link to comment https://forums.phpfreaks.com/topic/78252-storing-a-decimal-number/#findComment-396014 Share on other sites More sharing options...
mithpower Posted November 23, 2007 Share Posted November 23, 2007 Decimal would be what you need. decimal(4,2) if you want xx.xx Quote Link to comment https://forums.phpfreaks.com/topic/78252-storing-a-decimal-number/#findComment-397501 Share on other sites More sharing options...
revraz Posted November 23, 2007 Share Posted November 23, 2007 Why would float be so wrong? You definitely don't want FLOAT... use DECIMAL. Quote Link to comment https://forums.phpfreaks.com/topic/78252-storing-a-decimal-number/#findComment-397532 Share on other sites More sharing options...
fenway Posted November 23, 2007 Share Posted November 23, 2007 Because a float isn't an exact number. Quote Link to comment https://forums.phpfreaks.com/topic/78252-storing-a-decimal-number/#findComment-397537 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.