1 down vote favorite
You can't vote for your own post.
(click on this box to dismiss)
I have a very big problem with my website. I have a form, more like a text box used in submitting comments, that not the problem. The problem is displaying the comments. I want to display comments based on the friends a user added like the way facebook, twitter does.
I have 3 tables:photo_tb, comment_tb, friendship_tb.
The friendship_tb contains columns name, friend. name stores your email and friend stores the email of the person you add....
I need the photo_tb to get the picture of the person making the comment and I use a mysql join successfully.
In my comment_tb...i get the email of the person making the comment in my commentname column and comment made by the person...
I want to to show comment by friendship like if Mr A adds Mr B and Mr c..when Mr A logs on he should only get comments by both Mr B and Mr c and his comments doe not comments from Mr G or H.
This is what i have so far... IT shows comment of a users not added..eg mr a doesnt add mr b and is getting comments made mr b.Please help me
SELECT
comment_tb.comment_id
, comment_tb.comname
, comment_tb.comment
, comment_tb.time
, photo_tb.name
, photo_tb.photo
, friendship.name
, friendship.member
FROM comment_tb, photo_tb, friendship
WHERE
comment_tb.comname=photo_tb.name
and friendship.name = colname
and and friendship.member = comment_tb.comname.