寻找解决方案,以便在新数据到达数据库时刷新php [英] Looking for a solution to have php refresh when new data hits database

查看:72
本文介绍了寻找解决方案,以便在新数据到达数据库时刷新php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在寻找一个php和javascript解决方案,当有新数据输入数据库表时会显示特定的php页面。


因此,当表中的字段插入新数据时,可能会出现javascript警报或其他内容,可能会通知用户已插入新数据。实时我猜我正在谈论的是什么。如果没有UNIX cron工作,我甚至不知道如何实现它。 Cron并不是真正的解决方案,因为它应该是实时的。


有人可以告诉我这是否可能吗?


谢谢,


Frank

Hi everyone,

I am looking for a php and maybe javascript solution that will show a particular php page when there is new data entered into a database table.

So when a field in a table has new data inserted, maybe a javascript alert or something else could notify the user that there is new data inserted. Realtime I guess is what I am talking about. I wouldn''t even know how to go about implementing this without a UNIX cron job. Cron is not really a solution because it should be in realtime.

Can someone maybe tell me if this is at all possible?

Thanks,

Frank

推荐答案

Heya,Frank。


最简单的方法我可以想到这样做是为了记录用户检查新条目的日期。然后,您所要做的就是显示所有日期都在最后检查日期之后的条目。
Heya, Frank.

The simplest way I can think of to do this would be to log the date when the User checks for new entries. Then, all you have to do is display all entries whose date is after the last check date.



Heya,Frank。


我能想到的最简单的方法是记录用户检查新条目的日期。然后,您所要做的就是显示日期在最后检查日期之后的所有条目。
Heya, Frank.

The simplest way I can think of to do this would be to log the date when the User checks for new entries. Then, all you have to do is display all entries whose date is after the last check date.



Hey Pbmods!


感谢您的回复。也许我之前并不清楚,但是当user1正在处理网站的任何页面而另一个(完全独立的用户 - 用户不知道)将信息丢弃到数据库时,需要发生的事情是,有可能是一个javascript警告提醒user1新数据?总的来说,用户1 *不应该*检查更新。


换句话说,这样user1就不必回到某些屏幕并检查新数据。如果我不清楚,我很抱歉。


再次感谢,


Frank

Hey Pbmods!

Thanks for the reply. Maybe I wasn''t clear before but what would need to happen would be when user1 is working on any page of the website and another (completely seperate user-not known to user1) drops info to the db, is it possible for a javascript alert to alert user1 of the new data? The whole point would be so that user 1 *shouldn''t have to* check for updates.

In other words, so that user1 doesn''t have to go back to a certain screen and check for new data. I''m sorry if I am not clear.

Thanks again,

Frank


Heya,Frank。


所以你要说的是你想通过AJAX进行定期检查,以确定在用户进行更改时数据库是否已被修改。这是正确的吗?
Heya, Frank.

So what you''re saying is that you would like to do a periodic check via AJAX to see if the database has been modified while the User is making changes. Is this correct?


这篇关于寻找解决方案,以便在新数据到达数据库时刷新php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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