Steven Vona
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome.
ASKER