Tjk Posted May 16, 2006 Share Posted May 16, 2006 I'm having a problem with this little statement and I was wondering if someone could put me right on where i'm going wrong.[code]$query= mysql_query("SELECT * from friend WHERE {friend1='$userid' AND friend2='$_POST[friend]'} OR {friend1='$_POST[friend] AND friend2='$userid'}")or die("could not select friends record from friends");[/code]I only want to select the record (and as i have it setup there can only be one record) where either the user of the page's id is in either friend1 or friend 2 and the other use that they have selected in a pulldown list is in the other friend column.So for example if user of the page's id was 1 and the person they had selected had an id of 3 then it would select either when friend1 has the id 1 and friend2 has the id3 in it or friend1 has the id of 3 and friend 2 has the id of 1.Hope this is clear enough for you to understand. Help appreciated as always.-Tjk Link to comment https://forums.phpfreaks.com/topic/9804-using-multiple-conditions-in-select-statement/ Share on other sites More sharing options...
fenway Posted May 16, 2006 Share Posted May 16, 2006 Looks fine to me -- but you should be using parentheses, not curlies. Link to comment https://forums.phpfreaks.com/topic/9804-using-multiple-conditions-in-select-statement/#findComment-36361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.