Skipjackrick Posted March 28, 2008 Share Posted March 28, 2008 Currently I have a field on my db table called "length" Its set to "INT (255)" Well, lets say I have a length of "22.5" inches. When I enter "22.5" inches into the form it automatically rounds the number to "23" and stores it that way in the db. What would I change my field type to in order to accept decimal places??? Yet, still treat it as a number and not text? Quote Link to comment https://forums.phpfreaks.com/topic/98348-db-field-question/ Share on other sites More sharing options...
mwasif Posted March 28, 2008 Share Posted March 28, 2008 Use DECIMAL or DOUBLE datatype. Quote Link to comment https://forums.phpfreaks.com/topic/98348-db-field-question/#findComment-503290 Share on other sites More sharing options...
cooldude832 Posted March 28, 2008 Share Posted March 28, 2008 It isn't rounding for say its because 22.5 isn't an integer its a float So use a datatype that reflects your intentions or carry it across multiplied by 10 and then divide by 10 later to get around integer issues. Quote Link to comment https://forums.phpfreaks.com/topic/98348-db-field-question/#findComment-503303 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.