This article describes how to add counters on your own image website. & Nbsp; assume that you have multiple image sites as an example. first, insert several new data num and visited in the data table, this will be used on your image site. as long as the count1.php in the previous article (as the mainstream development language) SyntaxHi is described in this article, you can also add your own counters on your image site.
Assume that you have multiple image sites as an example. first, insert several new data num and visited into the data table, which will be used on your image site, you just need to change count1.php (as the mainstream development language) in the previous article.
Create a folder named count, and put the file count2.php (as the mainstream development language) and count3.php (as the mainstream development language )......, For example, the count2 source code changes count1.php (as the mainstream development language):
$ 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 = 2 ", $ linkptr );
$ Result = MySQL (the best combination with PHP) _ query ("select visited
From counter where num = 2 ", $ 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;
}
?>
Note: "After this step is completed, create a folder show and put the corresponding file show2.php (as the mainstream development language ),
Show3.php (as the mainstream development language )......, Taking show2.php (as the mainstream development language) as an example, the source code is written as follows:
Document. write (" ");
Note: Don't forget to add two points before count. this is the complete path!
Finally, place the code in the appropriate location on your image site:
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.