$username Posted October 7, 2007 Share Posted October 7, 2007 Hello Everyone, I have some code and I am trying to have an OR statement to have a value equal 2 numbers. I cannot seem to get this to work. any help would be great if ($username == $username2 && $usrrights == 120 OR $usrrights == 420) { echo "You do not have access to this page!"; } else { Thank you, Brett Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/ Share on other sites More sharing options...
darkfreaks Posted October 7, 2007 Share Posted October 7, 2007 <?php if ($username= $username2 || $usrrights == "120" OR $usrrights == "420") {?> Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364198 Share on other sites More sharing options...
$username Posted October 7, 2007 Author Share Posted October 7, 2007 Ok after looking into this. I find that If 120 or 420 do not equal then they can continue. It seems to not work when I do this. if ($usrrights != "120" OR $usrrights != "420" ) { echo "You do not have access to this page!"; } else { Thank you, Brett Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364209 Share on other sites More sharing options...
teng84 Posted October 8, 2007 Share Posted October 8, 2007 maybe if ($username= $username2 || ($usrrights == "120" OR $usrrights == "420")) Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364214 Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 thanks for adding that teng i was about to correct my mistake <?php if ($username= $username2 || ($usrrights == "120") OR ($usrrights == "420")){?> Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364215 Share on other sites More sharing options...
$username Posted October 8, 2007 Author Share Posted October 8, 2007 Thanks guys, That worked for what I needed. Brett Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364293 Share on other sites More sharing options...
darkfreaks Posted October 8, 2007 Share Posted October 8, 2007 which one tengs or mine? Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364297 Share on other sites More sharing options...
$username Posted October 8, 2007 Author Share Posted October 8, 2007 Well I used yours but I saw that teng84 did work fine. Thanks, Brett Link to comment https://forums.phpfreaks.com/topic/72227-solved-need-a-or-statement-for-2-numbers-to-be-used/#findComment-364613 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.