Is there a tutorial out there which shows you how to refresh a DIV upon a MySQL change? Like to show only the MySQL records above a certain timestamp and/or ID?
-
You'll have to poll the db at regular intervals. However, beware that polling solutions scale very poorly, so make the interval long enough.Marco– Marco2011-03-23 16:40:23 +00:00Commented Mar 23, 2011 at 16:40
-
Alternative to what Marco said would be to catch all changes to the database in your application and have your UI driven by that. It is like going from accessing your class members directly to having setters/getters (always a good idea)Zepplock– Zepplock2011-03-23 16:48:32 +00:00Commented Mar 23, 2011 at 16:48
Add a comment
|
1 Answer
I agree with the comments.
But, you can try to experiment an event-driven server side technology. For example, node.js (based on websockets).
Your client stays listening till an event occurs (database insert), and then, you can reload your div.
This is theory, but I'm sure you can do it this way.
But, as Marco said it, the best way is to set intervals to your refresh (poll method).
Regards.