johnnyd1963 Posted October 28, 2012 Share Posted October 28, 2012 Hi i have the following proplem I put in a table the following nummber 01 with a form if i want put in nummber 1 without zerro before i have the massege when i check the post is equal to the nummber in the table that these are the same the column in the table is VARCHAR how can i tell in php that 01 not is the same as 1 and visa versa or 02 not the same as 2 thanks in advice John Quote Link to comment https://forums.phpfreaks.com/topic/269994-number-1-not-equal-to-number-01/ Share on other sites More sharing options...
MDCode Posted October 28, 2012 Share Posted October 28, 2012 (edited) <?php if($var == "1") { // execute 1 } elseif($var == "01") { // execute 01 } ?> Edited October 28, 2012 by ExtremeGaming Quote Link to comment https://forums.phpfreaks.com/topic/269994-number-1-not-equal-to-number-01/#findComment-1388241 Share on other sites More sharing options...
johnnyd1963 Posted October 28, 2012 Author Share Posted October 28, 2012 can this in an array from 1 to 40 and 01 to 040 thanks Quote Link to comment https://forums.phpfreaks.com/topic/269994-number-1-not-equal-to-number-01/#findComment-1388245 Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2012 Share Posted October 28, 2012 In php, you would use an === (Identical) comparison. In mysql, you would force the comparison to be a binary comparison. Quote Link to comment https://forums.phpfreaks.com/topic/269994-number-1-not-equal-to-number-01/#findComment-1388247 Share on other sites More sharing options...
johnnyd1963 Posted October 28, 2012 Author Share Posted October 28, 2012 thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/269994-number-1-not-equal-to-number-01/#findComment-1388249 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.