Re: if statement with or comparison (newbie)

From: Date: Fri, 08 Sep 2006 21:29:47 +0000
Subject: Re: if statement with or comparison (newbie)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-241507@lists.php.net to get a copy of this message
I think the OR should be an AND ... If $_REQUEST['id'] = "black" then the second test will be true and it will output "wrong color." If the color is "white" then the same thing will happen 'cause it meets the first criteria. -- Mitch Kevin Murphy wrote:
Shouldn't that be this instead:
     if (($_REQUEST['id'] != "black") OR ($_REQUEST['id'] !=  "white")) {
         echo "wrong color";
     } else {
         echo "right color";
     }


« previous php.general (#241507) next »