a three way join mysql tables and php?

BM.

New Member
user_table\[code\] user_id | username 1 | solomon 2 | muna\[/code\]message table\[code\]id user_id| message 1 1 | this is my first message 2 1 | this is my seocnd message 3 2 | this is muna messgae \[/code\]relationship table\[code\] leader | follower 1 | 2 | \[/code\]what i want to do is a three table join to bring out muna's friend messages, currently muna is following solomon(as shown on the followers table),so i want the display to be like this on mona homepage\[code\]Solomon "this is my my first message----------------------------------solomon "this is my second message"\[/code\]p.s. this is just an example database, i just wanted to see how to approach the problem, and this is what i have attempted so far!\[code\] select username, message, leader from user, message, relationship where user.user_id =notes.user_id and user.user_id = relationship.leader and where user_id = $_SESSION['user_id']\[/code\]*the session id is muna which is user_id 2
 
Back
Top