Hi,
I want to create a join with id from $userid.
With my 2 tables,
users
id, username
1 a
2 b
3 c
friends
id, userid, friendid
1 1 2
2 1 3
3 3 2
My session variable $userid holds a userid.
Joins needs to get all friendid from friends table for the current userid, and for the corresponding friendid it needs to get username from users tables. I used this query but getting the wrong output.
Code:
SELECT friends.friendid,tbl_users.id,tbl_users.username
FROM friends,tbl_users
WHERE tbl_users.id='$userid'