Knowledge Base

Simple Web Counter

The simplest way to do this is to use MySQL and PHP, just have a database connection to update the count, get and display it, its crude but it works well :) Create a database and change to that database. Create table: ============= CREATE TABLE `counter` ( `counter` INT( 20 ) NOT NULL ); INSERT INTO counter VALUES (0); PHP Code: ========= To date, there have been <?php mysql_connect("localhost","DBUSER","DBPASSWORD") or die(mysql_error()); mysql_select_db("DB_NAME") or die(mysql_error()); mysql_query("UPDATE counter SET counter = counter + 1") or die(mysql_error()); $count = mysql_fetch_row(mysql_query("SELECT counter FROM counter")); mysql_close(); print "$count[0]"; ?> hits!