Hey people,
I've wrote a query to get a list of friends that a user is friends with. The table is made up of these fields:
username
friendusername
confirmed
username and friendusername could both be the user I am trying to get the list for. confirmed contains a simple yes or no.
So what I'm trying to get the query to ask is, get the friends of the user where either the username is the user's name and confirmed is equal to yes or where the friendusername is the user's name and confirmed is equal to yes.
This is what I have:
$query="SELECT * FROM Friends
WHERE username = '$user' AND confirmed = 'yes'
OR friendusername = '$user' AND confirmed = 'yes'
order by rand() Limit 6";
This does return results, just not the correct ones.
Anyone know if my query is wrong for what I'm trying to do?
Thanks.