I have guestbook with two columns,

username and Message

Suppose multiple visitors are inserting their comments/message how to display latest message first as soon as it is inserted into database and others below without refreshing page?

(Exactly same like facebook home page)


Please help

Thanks!

Member Avatar for diafol

A new page impression should show the data automatically. However, if you want real-time updating, that can be a little fiddly. There are two main options: COMET and AJAX.

Ajax is probably the easiest to implement, where you poll the DB every 30 seconds or so with an ajax call (js setInterval method).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.