MySQL Hit Counter
Downloads: 694
Required: php
Ratting: 3.8
It is simple php hit counter that uses MySQL database to store count logs. It can count hits for all the pages of your site.
Installation:
- Open counter.php with notepad and put your database hostname, username, password and database name correctly.
- Upload the counter.php file in to your server.
- Log in to your database with phpmyadmin and execute this query
- To add a page on database for counting logs log in to your database with phpmyadmin, click on Insert from the top menu of phpMyAdmin. Give a page name, no need to give id or hits, leave them blank.
- To add more pages repeat step 4 as many time as you need.
Counting and showing hits
Add the script below in you homepage where you want to show your hit counts.
Don't forget to check the correct url to counter.php
| <SCRIPT LANGUAGE="Javascript" SRC="counter.php?page=pagename"><!--//--></SCRIPT> |
Change the pagename with current page
name you provided on database.
Formatting hit counter text
Of course you can show the hit counter the way you like. Just insert the
code inside any html tags. Such as...
| <p align="Center"><b>This page has been visited total <font color="#FF0000"><SCRIPT LANGUAGE="Javascript" SRC="counter.php?=homepage"><!--//--></SCRIPT></font> since 1 January 2006</b></p> |
This would show this...
This page has been visited total 420 (;P) times since 1 January 2006 |
Troubleshoot:
This script is always showing 1:
Probably you didn't add the page on database. Use phpMyAdmin to login and
add that page in database.

Featured Items in php