954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

I want do that the users can view the last activities of her friends

I have a user model and friendship model. Now I want make that when one user have accepted a new friend, the others friends of this user could see this last activity of her friend. How is the best form to do it?

Thanks.

molistok
Newbie Poster
4 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

The first part has been covered recently - have you checked this forum??
If you freindship model/table is something as follows:

friend_id (int,primary key)
target (int, foreign key on user_id)
requester (int, foreign_key on user_id)
status (tinyint or char stating pending/acccepted/refused)
date_accept (date when accepted)

You have a variety of sql methods, including:

1) nested select statements
2) grouping with inner joins

These can be filtered so that only those within the last week say (calculated from date_accept) are displayed under a new friends section.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Hi, thanks for the reply, I have searched in the forum but I don't get the solution. I have the same model/table, one ask more: If I have a lot of people in the web, and therfore a lot of rows of friends, can do that this process will be very slow? I in the forum of database I did the same question and I get this reply:

Ramy Mahrous:
You merge logic or business of your application and the design of the database, you don't need to modify the design if you correctly did it, rather in application check the new friends list in a friend and show them in say news feed to their friends like Facebook.

After he told me that the best was that I will ask in this forum, and now I do it. Can any tell me how I can do the solution that he tell for do the same that Facebook or what is the best solution?
Thanks.

molistok
Newbie Poster
4 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You