tags:

views:

27

answers:

1

suppose i have two tables 1. messages 2. friends

than how can i get the activity of users from friends table and show it to current active user if 2nd or other user is in his friends list..........order by id just like facebook newsfeed

A: 

Maintain a session table where you store user sessions, place an index on the user_id in the session table. Query your database getting all friends of a user with a direct join on the session table.

Ben Fransen
but i want to store user activity in table for ever so that to show current user friends activity in his history or if he is not online and after getting online current user gets its friends recent activity order by DESC
testkhan
its the same.. only the tablename is not session but something like user_activity..? Just keep adding rows to it and fetch them using a query. IMO its kinda pointless to keep track of every login *forever*.
Ben Fransen