hit counter to count unique hits only
Posted: Sat Apr 25, 2009 2:01 pm
Hey,
I have just got my hit counter working storing the hits into mysql.
The problem is it is counting every time the page is refreshed etc... I just want it to show unique visits.
Here is my code:
Any help apreciated.
I have just got my hit counter working storing the hits into mysql.
The problem is it is counting every time the page is refreshed etc... I just want it to show unique visits.
Here is my code:
Code: Select all
<?php
$id=mysql_real_escape_string($_GET['id']);
//Adds one to the counter
mysql_query("UPDATE games SET hits = hits + 1");
//Retreives the current count
$count = mysql_fetch_row(mysql_query("SELECT hits FROM games WHERE id = '$id'"));
//Displays the count on your site
print "$count[0]";
?>