Soldato
- Joined
- 12 Feb 2006
- Posts
- 17,637
- Location
- Surrey
ok well im stuck trying to add a php counter which i have used times before, but now its not working so come here for some help.
this is the code im using
and to display it
this is just a straight copy from another site i made which it works completely fine for, well atleast the total hits and hits today works, but using it on new site i just get total hits but its actually displaying the total amount of unique hits.
So am i doing something wrong?
this is the code im using
Code:
<? include ("stats/db.php");
$date = date("M d, Y");
$hitadd= MYSQL_QUERY("INSERT INTO stats(date, ip)".
"VALUES ('$date', '$REMOTE_ADDR')"); ?>
and to display it
Code:
<?
include ("stats/db.php");
$date = date("M d, Y");
$uniquea = mysql_query("SELECT DISTINCT ip FROM stats");
$uniqueb = mysql_num_rows($uniquea);
$tdayua = mysql_query("SELECT DISTINCT ip FROM stats WHERE date = '$date'");
$tdayub = mysql_num_rows($tdayua);
$hitsa = mysql_query("SELECT * from stats");
$hitsb = mysql_num_rows($hitsa);
$tdayhitsa = mysql_query("SELECT * from stats where date = '$date'");
$tdayhitsb = mysql_num_rows($tdayhitsa);
echo ("Total Hits: $hitsb <br />
Total Unique Hits: $uniqueb<br />
Hits Today: $tdayhitsb<br />
Unique Hits Today: $tdayub
");
?>
this is just a straight copy from another site i made which it works completely fine for, well atleast the total hits and hits today works, but using it on new site i just get total hits but its actually displaying the total amount of unique hits.
So am i doing something wrong?