On Saturday 03 February 2001 15:02, James, Yz wrote:

> $sql = "SELECT * FROM table
>         WHERE username = '$username' AND password = '$password' AND
> site = 'theirsite' OR site = 'all'";

> So, without writing some if statements, is there any way of rewriting
> that $sql check so that it checks whether the user is an admin of
> either the individual subdirectory, or all of the sites?  Like
>
> username: foo  password: bar site: all
>
> or
>
> username: foo  password: bar site: subdirectory

Simply use brackets to specify the evaluation order:

SELECT * FROM table
         WHERE (username = '$username' AND password = '$password') AND
 (site = 'theirsite' OR site = 'all')

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to