Most people are eager to use databases for counters, message books, forums, and other things. This article will introduce self-made counter programs. & Nbsp; create 0 ~ 9 These 10 GIF digital images are placed in the img folder, and a php (as the mainstream development language) file-coSyntaxHigh many people are eager to use the database for their own counters, message book, Forum, and other things. This article will introduce self-made counter programs.
First, create 0 ~ 9 These 10 GIF digital images are placed in the img folder, and a php (as the mainstream development language) file is created.
-- Count1.php (as the mainstream development language), the program is as follows:
$ Linkptr = MySQL (the best combination with PHP) _ pconnect ("localhost", "yourname", "password ");
MySQL (best combination with PHP) _ select_db ("yourname", $ linkptr );
MySQL (best combination with PHP) _ query ("update counter
Set visited = visited + 1 where num = 1 ", $ linkptr );
$ Result = MySQL (the best combination with PHP) _ query ("select visited
From counter where num = 1 ", $ linkptr );
List ($ counter) = MySQL (the best combination with PHP) _ fetch_row ($ result );
$ Counter = sprintf ("% 05d", $ counter );
For ($ I = 0; $ I <5; $ I ++ ){
$ Tmpstr = "";
Echo $ tmpstr;
}
?>
Place code on the home page as appropriate In this way, your counter is displayed on the homepage, but remember to create a TABLE -- counter: create table counter (
Num int unsigned,
Visited int unsigned
);
How is it easy! In this article, I will introduce how to make your image site use your own counters.
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:
info-contact@alibabacloud.com
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