Re: if statement with or comparison (newbie)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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";

     }



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux