individual counter help
Posted: Thu Apr 25, 2002 9:51 am
I have written a stat counter for my site of the form
<?php
$db = mysql_connect("localhost", "root") or die ("unable to connect to server.<br>");
mysql_select_db("lithics_site",$db) or die ("Unable to connect to database.<br>");
$result = mysql_query("SELECT count(*) FROM counter",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<P class=normal>Site stats: %s Individual visits.</P>
",
$myrow["count(*)"]);
}
?>
does anyone know how I can have the server skip adding to the database if the ip address has already being listed. so the counter will show the number of individual computers that have accessed the site.
I have a feeling this can be done with if else statements but dont know how to impliment it.
<?php
$db = mysql_connect("localhost", "root") or die ("unable to connect to server.<br>");
mysql_select_db("lithics_site",$db) or die ("Unable to connect to database.<br>");
$result = mysql_query("SELECT count(*) FROM counter",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<P class=normal>Site stats: %s Individual visits.</P>
",
$myrow["count(*)"]);
}
?>
does anyone know how I can have the server skip adding to the database if the ip address has already being listed. so the counter will show the number of individual computers that have accessed the site.
I have a feeling this can be done with if else statements but dont know how to impliment it.