I have two tables comments and comments_liked. Users (viewer_id) can like comments written by (UID). Comments are stored in the comments table and comments that are liked are stored in the comments_liked table (as shown in the image attached).
**What Im trying to do:
When a user that has (viewer_id) as their id, found in the comments_liked table, is viewing their profile, they should see any comments that they have liked/given to a user (UID), Only when the comment does not exist in the comments table where uid = uid
Please don't get confused, as I am not trying to show all comments where uid=uid.
Below is my code in php
please note : if we can not say where comments_liked.uid != comments.uid as that would show all other values in the comments table.
$query = "
SELECT * FROM comments_liked
INNER JOIN comments ON uid = comments.uid
WHERE uid = ?
AND viewer_id = ?
";
but my code only prints the records where commnets_liked.uid = comments.uid which is the opposite of what I want.
so if I am user 1, I need to see the record from comments_liked where viewer_id = 1, as it does not exist in comments table.
THANKS FOR YOUR HELP!