using AND plus OR together

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevin5758
Forum Newbie
Posts: 1
Joined: Tue Jun 08, 2004 1:03 pm

using AND plus OR together

Post by kevin5758 »

I've looked and thought, but just can't figure this out. How do I do this simple if statement, using AND and OR together? Below is approximately what I am trying to do.

Can some kind soul supply the simplest way to do this?

if (( $userAccess < $recordAccess ) AND

( $recordType <> 'Type One' OR $recordType <> 'Type Two' )) {

}


Best regards,
Kevin
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Use more brackets to seperate what you want evaluated:

Code: Select all

if(($useraccess<$recordaccess) AND (($recordtype<>'Type One') OR ($recordType<>'Type Two'))){
   //blah
}
Post Reply