views:

37

answers:

1

How can one trigger an event locally when a field in a connected database changes? I've done some research but it seems like there there are varying and inconclusive answers to the question.

I'm building an application where users rate comments, and I'd like to have the ratings change live when they are modified by a different user. For example: users A and B are both viewing the comment feed. Say user A uprates a comment, causing the "rating" field for that comment's row in my database table to be incremented. Without having a timer for periodic refreshing, I'd like to have user B see the change in comment (updated on his page) as soon as A has rated it. Is there a way to do this using just PHP, SQL, and JavaScript/jQuery, or applicable plugins/libraries?

Examples, ideas, links, etc. all appreciated. Thanks so much for the help.

+3  A: 

The technique is called Comet, a play on words to Ajax. There are many ways to accomplish it. See here: http://en.wikipedia.org/wiki/Comet_(programming)

Mike Sherov
Seems to be what I'm looking for. Thanks, I'll check it out.
Matt Nichols