Hello,
I am working with PHP5 and mysql.
I am having 3 tables in database, as shown in image.
So i want to display the avatar and name of the friends for the current user.
- So when i query for the user 11 means, it must see the friendid of the user 11 from friends table which are 12 and 13.
- Next that 12 and 13 must be looked up on users table for username being the friendid of friend table is equal to id of users table
- Finally, for that 12 and 13 avatarid and avatarext must be looked from avatar table.
I tried this which displays only avatarid for the queried user, but i know how to join the other table.
Any ideas?
Thankyou
Code:
SELECT avatarext,avatarid
FROM avatar
WHERE userid IN(
SELECT friendid
FROM friend
WHERE userid='11';