View Full Version : Actively updating web pages

08-13-2006, 12:18 PM
Hi. I'm looking to create a page which will update in real time as values in a mysql database change without having to actively refresh the page but I'm not sure which web languages I should look to for this. I've wondered if placing a Java or Flash applet in the page which then runs a query to the database may work.

I know Java can be used to place a query but it lacks the same dynamic visual creation as Flash offers. Although I'm not sure how to have it constantly querying the database.

Using Flash I know I could export any form data by using getURL and linking to a php processing script but I'm still not sure on what other language I'd need to use to actively update the page with the changing mysql row values... it's on a Linux server so no ASP here. Any ideas on the language to do this?

With both I'm still unsure if they have the option to keep a constant connection open to the mysql database detecting a change in the database values. Is this actually possible?

The other part of this is the actual server side processing. At the moment I'm using CRON to constantly reload a PHP script which updates all the mysql values in real time. I could use PHP Forking which seems a very attractive option or I could create a PERL server process. Which one would be more efficient?

Any comments on any part of this problem will be appreciated. Hopefully I can piece together all the advice I can get from you gurus and start heading in the right direction. :thumbsup:

08-13-2006, 06:10 PM
Chatrooms that use MySQL, use Javascripting to refresh the pages.
I'm not sure if that's the best way, but that's what they do.
If people have javascripting turned off, I guess they can't use chatrooms.

08-14-2006, 04:00 AM
I have been thinking along similar lines although not using MySQL,
I have a background process (cron) that writes the data to .js files
I am thinking I can have the main page that refreshes itself thus
including the new data and updates elements on the display page
(child window) using javascript. This is not exactly event driven
(changes in the data change the page) but it does emulate it.
In this way everything except the cron is done client side..
To be honest I am not certain it will work as i want
and i may need to use cookies to store user preferences..

The only real data-driven applications I have seen are written in java.

08-14-2006, 09:28 AM
Yes, If the users turn off the java script, they cannot use chatrooms.