I have a small blog that I am creating. It gets its information from a database. I would like to show the users that are logged in that someone else has just entered a new comment. I have created 3 pages: old_count, new_count, posts. I was going to create a session for both new_count and old_count and subtract them in posts. The result would have been displayed in a div to the user. This idea I have scrapped because both old_count and new_count would have the same information, so the result in posts would have always been 0. What I am looking for is something like Twitter where if there is a new entry, a div appears displaying –1 New post–. I have being looking for a way to do this. Can someone please help me. (Note – please explain script given in full….Thanks In Advance!!!!)
Share
Set a timestamp of the last time they checked for content.
then, using javascript, poll the server (SELECT * FROM posts WHERE created_timestamp > {$last_checked_timestamp}
If result > 0 then display count.
Update timestamp.