Re: What's wrong with this IF statement?

From: Date: Thu, 22 Apr 2004 19:27:16 +0000
Subject: Re: What's wrong with this IF statement?
References: 1  Groups: php.db php.general 
Request: Send a blank email to php-db+get-34051@lists.php.net to get a copy of this message
From: "Robert Sossomon" <robert@gcnorris.com> > if ($cat_id != "53" || $cat_id != "54" || $cat_id != "55" || > $cat_id > != "117" || $cat_id != "118" || $cat_id != "74") Okay, if $cat_id is 53, this will work out to: if(FALSE || TRUE || TRUE || TRUE || TRUE || TRUE) which results in TRUE overall. You want && instead of || if ($cat_id != "53" && $cat_id != "54" && $cat_id != "55" && $cat_id != "117" && $cat_id != "118" && $cat_id != "74") which results in if(FALSE && TRUE && TRUE && TRUE && TRUE && TRUE) which results in FALSE overall. ---John Holmes...

« previous php.db (#34051) next »