Jump to content

addy_010

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

addy_010's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 <? 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 <? 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 a weird total amount of unique hits as once the viewer views it on one day, it then adds to the total hits, and can't be added again until the next day, if that makes sense. This is not my code btw so i don't fully inderstand php yet. So am i doing something wrong?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.