Link to home
Start Free TrialLog in
Avatar of Steven Vona
Steven VonaFlag for United States of America

asked on

PHP if statement multiple conditions

I can find plenty of resources on how to include multiple conditions, but not with a session variable.

So this is my code which is working.  I need to allow this page to be viewed by only two people with member id of 88 and 89.

So if I use this code:

if ($_SESSION[Memberid] != "88") {
header("Location: home.php");
}

It works fine for allowing the one person.  It sends anyone with any other memberid to a home page.

Now, I want to add access for someone with the id of 89. So I tried:

if (($_SESSION[Memberid] != "88") || ($_SESSION[Memberid] != "89")) {
header("Location: wholesale-home.php");
}

Which doesnt work. Any help would be appreciated for this php noob.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steven Vona

ASKER

Thanks, I do not know why I didn't see that myself!  Thanks!
You're welcome.