Quantcast
Channel: Making a user profile activity feed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Making a user profile activity feed

$
0
0

I need to build an activity feed to go on each users profile page showing what they have been doing on the site.

There is three tables: comments, ratings, users

I want the feed to include the comments and ratings that the user has posted.

in the comments and ratings table it stores the user id of the user who posted it, not the username, so in for each item in the news feed it needs to select from the users table where the user id is the same to retrieve the username.

All the entries in the feed should be ordered by date.

Here is what ive got even though i know it is not correct because it is trying to match both with the same row in the users table.

SELECT comments.date, comments.url AS comment_url, comments.user_id, ratings.date, ratings.url AS rating_url, ratings.user_id, users.id, users.usernameFROM comments, ratings, usersWHERE comments.user_id=%sAND comments.user_id=users.idAND ratings.user_id=%sAND ratings.user_id=users.idORDER BY ratings.date, comments.date DESC

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images