I'm drawing a blank this late at night after programming all day and maybe someone else can help shed light on where my issue lies. I'm trying to make a MySQL query in PHP where it gets the correct fields based on multiple variables using AND and OR.
Here is what I'm trying to do that is not working:
$result = mysql_query("SELECT * FROM tableName
WHERE key = '$key' ((userFrom = '$userFrom' AND userTo = '$userTo')
OR (userFrom = '$userTo' AND userTo = '$userFrom')");
Basically in English what this does is it needs to know the Key value. Once it matches the key value then I need all the rows with that key value that are ALSO - FROM or TO the same users - think of it as a conversation between two people it has to have their conversation topic (key) and the two participants (from and to).
Any suggestions?
key = '$key'and the following parenthesis – is this a typo in your example?