In this tutorial Hermawan will teach you how to create an auto refreshing page. The trick he will show you is how to have the page only refresh when there is new data to display.
By : Hermawan Haryanto
Have you ever thought about how to make a website able to reload itself whenever the content inside the page is updated through another application or another page? Well I have.
A few months ago I had a project from my employer to make a report, which would be displayed on the director's screen. The report had to include the progress of sales in real time. The cashier would enter the sales data whenever a product was sold. Sales data would be entered into a database, then the report page on the director's screen needed to refresh when the data was updated. When no sales were made or the data was not updated the report page would not refresh.
In this article, I will show you how to build a Smart Auto Refreshing report page.
Who in this cyber world doesn't know what a shoutbox is? Well even though I know that many of you understand what a shoutbox is, I'll explain a little about it here.
A shoutbox is a small application which works like a guestbook for a website, where a visitor can leave a message for the website owners. The shoutbox also works like a chat room, in that all visitors can chat on a web page using the shoutbox. That's why they call it Shout!, because they can shout at each other in that little box.
There are many shoutbox providers these days. Some are free and some are commercial. They have many features in the shoutboxes they provide, like IP banning, user accounts, and of course the Smart Auto Refresh that we will learn today.
First, the shoutbox will need a table to store the visitor's messages. Here is the schema of the table that we are going to use. You can add your own additional fields after you understand the use of each field. Open your phpMyAdmin and run this SQL in the SQL execution box.
CREATE TABLE `chat` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `message` varchar(255) NOT NULL default '', `msgdate` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1;