[thelist] mySQL Select

Mark Joslyn Mark.Joslyn at SolimarSystems.com
Mon Jul 7 13:45:51 CDT 2003


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

This is returning everything.

1. There are two types of stores "blah" and "blip". I want only stories
labeled "blah"
2. $_SESSION['qual2'] must equal another variable( if ($_SESSION['qual2'] ==
$qual_verifier) { ...) for the record to be returned. I want to return only
the stories with "qual1" and "$_SESSION['qual2']" permissions.

Any ideas?

mj




More information about the thelist mailing list