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.

  1. each update stored timestamp of when created.
  2. javascript figures out timestamp of latest update displayed on site.
  3. ajax request asks "updates newer [timestamp determined in 2.]" , injects results page.
  4. goto 2.

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -