Crew-Portal Posted August 29, 2007 Share Posted August 29, 2007 Hi I need some help with my code! I am making a ranking system for my Virtual airline that displays according to how many hours you filed it displays a diffrent rank allowing you to do diffrent stuff! anyways here is my code: <?php if ($hour == 0){ echo 'No Rank'; //I want this to be if they have nothing registered! This Part of the code works } elseif ($hour < 9.99){ echo 'Trainee'; //I want this to be if they have less than 9.99 hours! This Part of the code works } elseif (($hour >= 10) || ($hour <= 30)){ echo '1st Officer'; //I want this to be if they have less than hours! This Part of the code works } elseif (($hour <= 30.01) || ($hour >= 60)){ echo 'Another Rank'; //My problem is if they have like 34 hours it doesnt display this rank but it displays ^ one } else { echo 'Rank Invalid'; } ?> Can someone help me with this! I posted whats wrong with the code in the comments for the php above! Quote Link to comment https://forums.phpfreaks.com/topic/67222-if-greater-equal-or-less-than/ Share on other sites More sharing options...
Jessica Posted August 29, 2007 Share Posted August 29, 2007 You're using || which means Or. You want && which means And. This: elseif (($hour >= 10) || ($hour <= 30)){ Means if it's greater than or equal to ten OR less than or equal to 30. 34 is >= 10. Quote Link to comment https://forums.phpfreaks.com/topic/67222-if-greater-equal-or-less-than/#findComment-337191 Share on other sites More sharing options...
chanchelkumar Posted August 31, 2007 Share Posted August 31, 2007 thanks rose?? Quote Link to comment https://forums.phpfreaks.com/topic/67222-if-greater-equal-or-less-than/#findComment-338492 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.