I have the following query that takes the user's bookmarks ID=X
$sql="SELECT * FROM user WHERE id IN (SELECT user_2_id FROM favoritos WHERE
user_1_id =$id_user_logado)";
Now, how can I get the user picture of the users who leave this query? The id
of the photo is saved in the user's table in the photo_p_id
field and the photo information is in the photos
table as the location of the photo.
Something like this:
$sql="SELECT * FROM user WHERE id IN
(SELECT user_2_id FROM favoritos WHERE
user_1_id =$id_user_logado)
LEFT JOIN photos AS p
ON user.photo_p_id=p.id
";