bg1982 Posted October 26, 2006 Share Posted October 26, 2006 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. Quote Link to comment Share on other sites More sharing options...
btherl Posted October 26, 2006 Share Posted October 26, 2006 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. Quote Link to comment Share on other sites More sharing options...
bg1982 Posted October 26, 2006 Author Share Posted October 26, 2006 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. Quote Link to comment Share on other sites More sharing options...
btherl Posted October 26, 2006 Share Posted October 26, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.