[thelist] mySQL Select
Tab Alleman
Tab.Alleman at MetroGuide.com
Mon Jul 7 13:54:38 CDT 2003
Mark Joslyn wrote:
> I am having a little trouble structuring a SELECT statement in
> mySQL/PHP:
>
> $sql = "SELECT * FROM table WHERE (story = 'blah') AND (person =
> 'qual1') OR (person = '" . $_SESSION['qual2'] . "')"; $result =
> mysql_query($sql);
>
Any time you mix AND and OR in sql, you gotta be careful with the Parens
()'s
try
> $sql = "SELECT * FROM table
WHERE (story = 'blah')
AND ((person = 'qual1') OR (person = '" . $_SESSION['qual2'] .
"'))";
More information about the thelist
mailing list