Please help me if you have any idea how would you solve the following problem:
I want to display to user on home page a notification when a friend of user changes profile. Changes can be new video, new photo, new comment.
In each notification will be an information about who did change, what kind of change he/she did and time.
I was thinking to put all changes into new table (columns: ID, userID, changeTitle, time) but I don't know how to display only new updates (which weren't displayed in user home page yet), not all of them.
Thank you
How to display only new updates (new user photo, new comment
Moderator: General Moderators
Re: How to display only new updates (new user photo, new comment
Can you post your code?
-
mickeyunderscore
- Forum Contributor
- Posts: 129
- Joined: Sat Jan 31, 2009 9:00 am
- Location: UK
Re: How to display only new updates (new user photo, new comment
When a user logs in, could you save the current time in the database? Then you could easily fetch everything which is newer than their last login.
Re: How to display only new updates (new user photo, new comment
mickeyunderscore thanks I think I almost know now how to do. Now I just don't know how to delete all older rows older than previous one, not older than current one. So I need to keep current time and previous one until user log in again.
Re: How to display only new updates (new user photo, new comment
Wouldn't you need to keep it in case other people require that information as well? Unless you only display this information to one user, once.meee wrote:mickeyunderscore thanks I think I almost know now how to do. Now I just don't know how to delete all older rows older than previous one, not older than current one. So I need to keep current time and previous one until user log in again.
Re: How to display only new updates (new user photo, new comment
I was thinking to create new table LoginTime with columns: userID, cLogin (as current login time) and pLogin (as previous log in time). Second table would be Changes.watson516 wrote:Wouldn't you need to keep it in case other people require that information as well? Unless you only display this information to one user, once.meee wrote:mickeyunderscore thanks I think I almost know now how to do. Now I just don't know how to delete all older rows older than previous one, not older than current one. So I need to keep current time and previous one until user log in again.
Then I will display all rows from table Changes in period of time between cLogin and pLogin from table LoginTime where userID is same as user. For every new login information will be displayed and then cLogin (current login from previous login) will be inserted into pLogin and current login time into cLogin.
Does mysql a function to call the oldest or the newest row?
Re: How to display only new updates (new user photo, new comment
You can Order your results by date.meee wrote: Does mysql a function to call the oldest or the newest row?
Code: Select all
<?php
$q="SELECT * FROM table ORDER BY date DESC";
$result=mysql_query
?>