Panjabel Posted July 15, 2007 Share Posted July 15, 2007 <?php $ok = "60"; if ($ok>30) || ($ok<=50){ print "30-50"; } else { print "60-over"; } ?> what is wrong ? Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 <?php $ok = 60; if (($ok>30) || ($ok<=50)){ print "30-50"; } else { print "60-over"; } ?> Quote Link to comment Share on other sites More sharing options...
Panjabel Posted July 15, 2007 Author Share Posted July 15, 2007 <?php $ok = 60; if ($ok>30) || ($ok<=50){ print "30-50"; } else { print "60-over"; } ?> doesn't work too Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 Sorry, my C programming days kind of blended in with PHP. Look at the modified code above. Quote Link to comment Share on other sites More sharing options...
Panjabel Posted July 15, 2007 Author Share Posted July 15, 2007 <?php $ok = 60; if (($ok>30) || ($ok<=50)){ print "30-50"; } else { print "60-over"; } ?> doesn't work too, $ok = 60; so i want it to print out "60-over" but it print out "30-50" what's wrong ? Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 <?php $ok = 60; if (($ok>30) || ($ok<=50)){ print "30-50"; } else { print "60-over"; } ?> doesn't work too, $ok = 60; so i want it to print out "60-over" but it print out "30-50" what's wrong ? Ohh I see. You're using || which means OR. You need to use && (and): <?php $ok = 60; if (($ok>=30) && ($ok<=50)){ print "30-50"; } else { print "60-over"; } ?> Quote Link to comment Share on other sites More sharing options...
Panjabel Posted July 15, 2007 Author Share Posted July 15, 2007 Great! Thanks Quote Link to comment 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.