Getting friend list from MySQL using PHP -
i have tables in mysql database, users , friends. have structure:
users table:
friends table (two users friends if exists 2 rows in image):
i want create mysql query in php select nombre (name) of users friends. read have use operator left join did not succeed.
thank you!
try using inner join
instead. try below query -
select users.nombre users inner join friends on (users.id = friends.usuari_o or users.id = friends.usuari_t) (friends.usuari_o = $id or friends.usuari_t = $id);
Comments
Post a Comment