I have a three tables that are left join. two of them have uid as user id. Problem is every time query execute it takes the same user id.
Please check the table structure
-------------------------------------
|Users |posts |favorites |
|-----------|-----------|-----------|
|user_id |id |id |
|username |title |uid |
|password |post |post_id |
| |uid | |
| |favorites | |
-------------------------------------
MySQL query
SELECT * FROM favorites
LEFT JOIN users ON users.user_id = favorites.uid
LEFT JOIN posts ON favorites.posts_id = posts.id
WHERE favorites.uid='$id' and posts.active=1
please note that $id is the profile owner (user) id. Any help will be appreciated.
See Question&Answers more detail:os