Veritabanı değişiklikleri bildirilmesi kullanıcıları

0 Cevap php

I have, at its heart, a php/mysql application. Every ~15 minutes new data is added to the database. I want to notify users that new data is in the database. I was thinking of having some JS run on the clients computer to check for updates every 60 seconds, but I don't want to pull down the results unless something has actually changed/been added in the DB.

So my question is: using PHP/JS/MYSQL what is the best way for clients to detect new rows in the DB?

One possible solution I was kicking around was having a seperate table called "switch" with a BOOL called 'switch', and everytime I update the DB setting "switch" to true for 60 seconds. Then the client computers check to see if switch.switch = '1' (true) every 60 seconds. Thoughts? I'm open to suggestions on any part of this plan? I do have the jQuery library loaded if anyone wants to make a jQuery suggestion...

0 Cevap