add to that i'd do this

if ($_GET['sc'] !== '2' || $_GET['sc'] !== 8) {

for me single equals seem to assign the variable with the value double
equals seem to check the variable for the value

"Jonathan Wright" <[EMAIL PROTECTED]> wrote in message
20021120184141.GA12806@chef">news:20021120184141.GA12806@chef...
> Hiya,
>
> On Wed, Nov 20, 2002 at 11:24:11AM -0600, Jami wrote:
> > I have code that says:
> >
> > if($_GET['sc'] != '2' OR '8'){
> >     do this.....
> > }
> >
> > but I doesn't work. What do I need to do to get it to work? I have
checked
> > operator precendence and all that and am still confused on whether I
should
> > be using '||' or 'OR' or something else... I have tried both of those,
as
> > well as 'XOR' and '^'. Help please!
>
> It won't work 'cause you're asking two different questions:
>
>  1. if $_GET['sc'] != 2, and
>  2. 8
>
> Operators can only work on two operands, i.e. one either side, so you if
> you want to ask any more questions, like above, you have to split them
> each into their own question:
>
>   if ($_GET['sc'] != '2' || $_GET['sc'] != 8) {
>
> It also works the same when looking for a range like '2 < $x < 6', it has
> to be two questions - '2 < $x && $x < 6'.
>
> Hope that helps! :)
>
> --
> Jonathan Wright..
> // [EMAIL PROTECTED]
> // www.djnauk.co.uk
> --
> // life has no meaning unless we can enjoy what we've been given



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

Reply via email to