jeff5656 Posted October 30, 2009 Share Posted October 30, 2009 If I store a number in a varchar format, can I still treat it like a number, so something like this: if ($test > 3) { do this } Link to comment https://forums.phpfreaks.com/topic/179628-int-versus-varchar/ Share on other sites More sharing options...
smerny Posted October 30, 2009 Share Posted October 30, 2009 php is flexible, it will work strings as ints (or floats etc if needed) if it has strictly a numeric value Link to comment https://forums.phpfreaks.com/topic/179628-int-versus-varchar/#findComment-947802 Share on other sites More sharing options...
Mchl Posted October 30, 2009 Share Posted October 30, 2009 You're asking about datatype in database table? Link to comment https://forums.phpfreaks.com/topic/179628-int-versus-varchar/#findComment-947850 Share on other sites More sharing options...
jeff5656 Posted October 30, 2009 Author Share Posted October 30, 2009 Thanks. By converting to varchar, I dont have to deal with the headache of blanks int he forms (that with INT will be a zero, but with varchar they will be blank). I just wanted to make sure that I could treat these as numbers if I need to do that in the future. Thanks. Link to comment https://forums.phpfreaks.com/topic/179628-int-versus-varchar/#findComment-947854 Share on other sites More sharing options...
Mchl Posted October 30, 2009 Share Posted October 30, 2009 As long as you don't try to sort them, and are confused when 10 comes before 2. Link to comment https://forums.phpfreaks.com/topic/179628-int-versus-varchar/#findComment-947858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.