Most people are very yearning to use the database to do their own counters, message book, Forum and other things, this article will introduce my self-made counter program.
First set up the 0~9 10 gif digital pictures, put in the IMG folder, and then build a PHP file
--count1.php, the procedure is as follows:
$linkptr =mysql_pconnect ("localhost", "yourname", "password");
mysql_select_db ("Yourname", $linkptr);
mysql_query ("Update counter
Set visited=visited+1 where Num=1 ", $linkptr);
$result =mysql_query ("Select visited
From counter where Num=1 ", $linkptr);
List ($counter) =mysql_fetch_row ($result);
$counter =sprintf ("%05d", $counter);
for ($i =0; $i <5; $i + +) {
$tmpstr = "";
Echo $tmpstr;
}
?>
Place the code in the appropriate place on the home page so that your counter is displayed on the home page, but remember to create a table--counter:create table counter on your database (
num int unsigned,
visited int unsigned
);
How easy it is! Medium I'll show you how to get your mirror station to use your own counter as well.
The above describes the counter and its application to build a counter DIY three-step, including the counter and its application aspects, I hope that the PHP tutorial interested friends helpful.