datoshway Posted November 17, 2011 Share Posted November 17, 2011 Below is my code, not working, seems to be displaying both even if boolType=1 <?php if ($boolType == 1) { echo 'Go'; } else { echo 'Fail'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/251289-help-with-if-query/ Share on other sites More sharing options...
Pikachu2000 Posted November 17, 2011 Share Posted November 17, 2011 What does var_dump($boolType); show? Quote Link to comment https://forums.phpfreaks.com/topic/251289-help-with-if-query/#findComment-1288848 Share on other sites More sharing options...
onlyican Posted November 17, 2011 Share Posted November 17, 2011 I would guess by the name $boolType is a boolean (true / false) Therefore $boolType does not equal 1, its true if($boolType == true){ echo 'True'; }else{ echo 'its false'; } // ANOTHER OPTION, the same as above // The default of below is to check if something is true if($boolType){ echo 'True'; }else{ echo 'false'; } Quote Link to comment https://forums.phpfreaks.com/topic/251289-help-with-if-query/#findComment-1288888 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.