To all,
I'm having difficulty getting my page hit counter to work. I've conscripted some code in hopes of updating my database everytime somebody hits my site and register the page they first visit as well as the date. This will give me information as to how many hits a day I get and which page was hit first. Everything works for the first day, but the script is not creating a new record for new days. This means I'm only getting information for a page on the first and only the first day it is ever hit. Below is the code. Maybe somebody out there can tell me why my database won't update new dates for existing page entries.
<?php session_start();
require_once('Connections/connZephyrDB.php');
if (!session_is_registered("counted")){
mysql_select_db($database_connZephyrDB,$connZephyrD😎;
mysql_query("UPDATE hit_counter SET counter=counter+1 WHERE date= NOW() AND page = '$PHP_SELF'",$connZephyrD😎;
if (mysql_affected_rows($connZephyrD😎 < 1) { $result = mysql_query("INSERT INTO hit_counter VALUES (NOW(),'$PHP_SELF', 1)", $connZephyrD😎;
}
mysql_close($connZephyrD😎;
session_register("counted");
}
?>