使用AJAX和SQL监控数据库更新直播 [英] Monitor Database Updates Live using AJAX and SQL

查看:313
本文介绍了使用AJAX和SQL监控数据库更新直播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个人怎么可以在本地触发事件时,在连接数据库更改一个字段?我做了一些研究,但它好像有有不同和不确定的问题的答案。

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.

我要建一个应用程序,用户评价意见,我想有收视率的实时变化时,它们是由不同的用户修改。例如:用户A和B都是观看注释饲料。假设用户A uprates评论,引起了等级字段的注释行中我的数据库表进行递增。无需定期清爽的定时器,我想有用户B参见注释(更新他的网页)的变化,一旦A已经评了。有没有办法做到这一点只用PHP,SQL和JavaScript / jQuery的,或适用的插件/库?

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?

例子,思想,链接等所有AP preciated。感谢这么多的帮助。

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

推荐答案

该技术被称为彗星上的话Ajax的一出戏。有许多方法来完成它。在这里看到: http://en.wikipedia.org/wiki/Comet_(programming)

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)

这篇关于使用AJAX和SQL监控数据库更新直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆