English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What i mean is, upon updating the databases it will automatically display the updated databases to the site.

2006-09-17 19:21:07 · 3 answers · asked by edwinbiasbas 1 in Computers & Internet Programming & Design

3 answers

So you're saying you don't want the user to ahve to refresh the page in order to view the new database information?
If so I recomend putting a meta refresh tag in the head part of the document and have it refresha bout every 30-120 seconds. Depending on how many people will be looking at it any more than that might just be a waist of bandwidth.
The only problem with this is that when the page refreshes the user can tell. I suggest fixing this by putting the information in an i-frame so that the actual page won't refresh. The user might see a little white line go down the page when refreshing, but the good thinga bout this is that it's not the whole window. Of course there are other options, but this is the fastest, and in most peoples situation the most affective solution.
BTW you can also use this method for making chatrooms.

2006-09-17 19:31:10 · answer #1 · answered by mattmaul92 3 · 1 0

The web is set up on a browser-fetches-pages-from-server premise, and when the page is done the conversation with the server is over. So a server can't tap a browser on the shoulder and hand it more data. However, you can use Javascript to periodically ask the server whether anything has changed, and when it does, load the new data.

So your solution will contain at least two pieces: an HTML page containing Javascript code in the browser, and a PHP script on the server. Start by isolating the part of your current PHP page that handles the database, and convert that into a stand-alone script that takes GET or POST requests and returns formatted data from the database (it should be a complete HTML page for this example, and you should be careful to authenticate the user and take steps to prevent hacks like SQL injection). Then work up a Javascript powered page that will load the database script into an