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 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 <?php if($var == "1") { // execute 1 } elseif($var == "01") { // execute 01 } ?> 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 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. 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 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
Archived
This topic is now archived and is closed to further replies.