I have a members search function on my website. What it basically does is getting some info from the leden table and show it for each member found, except for yourself.
The $id is the person that's logged in.
Right now, this is my current query:
$sql = "
SELECT ldn.schermnaam, ldn.geboortedatum, ldn.userid, ldn.foto, ldn.oproep
FROM leden AS ldn
WHERE ldn.userid != $id
";
This works fine.
Now what I want is to also exclude members that are blocked by you. The blockedmembers table looks like this:
- ID
- Useridsender (the one that blocked the other one)
- Useridreceiver (the one that has been blocked)
- Creation date
Now I want to exclude the blocked members and don't show them in the result list.
I tried using INNER JOIN and LEFT JOIN, but haven't figured out how to get a good query. Anyone knows how my query should look like?
p.s. it's a dynamic query, so based on the user input AND statements are added at the end.