Jump to content

Archived

This topic is now archived and is closed to further replies.

bg1982

MySQL db watcher

Recommended Posts

I am trying to make my webpage refresh whenever I have a new record entered to the database with a predefined threshold, it's like filesystem watcher, but here I want to watch a specific table with a specific field.

what I know that we can use file system watcher using VB.Net and watch the database files for change, but that would be very generic and any change in the database would refresh the page.

any idea.
thanks.

Share this post


Link to post
Share on other sites
You could do it ajax style, and use javascript to poll regularly.  For example, every 10 seconds you could send a request to a php script which returns "Yes" if there's another record, or "No" otherwise.

Or, building on the file system watcher, you could have the process which creates the new database record also create a file (or update a file).  Then your file system watcher can be triggered.

Share this post


Link to post
Share on other sites
Thanks for the idea, but my application is very time sensitive we are talking milliseconds... and concerning the filesystem watcher, as I understood you want me to watch the table file in the database directory, but this will trigger my webpage anytime any change happened to my database, where what I am looking for is a specific field with specific value.

Share this post


Link to post
Share on other sites
Milliseconds?  I guess polling isn't going to work then.

What I was suggesting was to have something like

[code]mysql_query("UPDATE ... ");
touch("/tmp/database_is_updated");[/code]

The idea being to actively create/modify a file to indicate that an update has happened.  It could also be done with a trigger depending on your DBMS.  If you can have a trigger which modifies a file whenever the specific field is updated, and a file system watcher which notices that, then that file can be a method of signalling the watcher that a change has occurred.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.