phppup Posted March 16, 2012 Share Posted March 16, 2012 My DB has fields that primarily record numeric values. I've noticed that a NUMBER in a VARCHAR field is aligned to the right and will hold decimal places, and a SMALLINT seems to align left and strip whole numbers to the bare digit (eg.: 4.0 is held to 4). What's the best way for me to store values, if I want them to hold at least ONE decimal place (so that whole numbers line up EVENLY with fractions: 1.0 1.5 2.0 etc? Is there a way to "adjust" a setting within MySQL? Or in the query that pulls the info? Quote Link to comment https://forums.phpfreaks.com/topic/259071-smallint-vs-varchar/ Share on other sites More sharing options...
scootstah Posted March 16, 2012 Share Posted March 16, 2012 You need a float datatype. http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html Quote Link to comment https://forums.phpfreaks.com/topic/259071-smallint-vs-varchar/#findComment-1328170 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.