Use the following PHP tutorial to help you create a hit tracker.
Insert Into Mysql Database
Code:
CREATE TABLE `mini_hits` (
`hits` int(10) NOT NULL default'0'
);
INSERT INTO `mini_hits` (hits) VALUES ('hits');
tonfig.php
Code:
<?php
$config = array(
//Mysql Settings
'dbHost' => 'localhost',
'dbName' => '',
'dbUser' => '',
'dbPass' => '',
);
?>
counter.php
Code:
<?php
include("config.php");
//Connect To Mysql
mysql_connect($config[dbHost],$config[dbUser],$config[dbPass]);
mysql_select_db($config[dbName]);
//Count Hits
$result = mysql_query("SELECT * FROM `mini_hits`");
$row = mysql_fetch_array($result);
$row[hits]++;
$update = mysql_query("UPDATE `mini_hits` SET `hits`='$row[hits]'");
echo "Total Hits: $row[hits]";
?>
Example Here
Brought To You By PHPMini
Wow, that surely sucked..
What's with the SELECT * querys?
you know what all the columns are named. select * will force mysql to make an extra query, just to find out what the columns are named..
Just use SELECT hits FROM blabla..
Also, instead of grabbing the amount of hits, letting php add one to it, just do UPDATE mini_hits SET hits = hits + 1