php - Updating recent updates - Problem in procedure - Any other approach? -
i have section in website called recent updates. in show latest 5 updates @ first when page rendered.
when new update done @ real time, new update appended top of updates list , last 1 deleted.
my approach:
for problem, im doing is, first renders page last 5 recent updates. fetching updates database. when update made in realtime, stored in database flag = 0.
to find out whether update made, have javascript calls ajax page every 4 seconds. ajax page checks in db whether records flag=0 present. if of there, return update flag=0 , set flag 1.
problem:
it working fine on single system. havent tested on multiple system @ same time. i fears, each update can viewed single user
, flag set 1. other users may not it.
is there alternate approach in solving issue?. may changing query or may yield goodness. expecing experts here.. appreciated.
- each update stored timestamp of when created.
- javascript figures out timestamp of latest update displayed on site.
- ajax request asks "updates newer [timestamp determined in 2.]" , injects results page.
- goto 2.
Comments
Post a Comment