Counter and its application build counter DIY three-step

Source: Internet
Author: User
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.