Long time no see. I've run into a bit of a wall. I'm trying to track stats for a pop up/detail page based on the "name" variable passed from the master page. This Master/Detail combo is used throughout my site and my tracking package only measures the number of times the file was opened, ignoring the contents that appeared inside of it. I've had some success with inputing some of the information I need into my db with the following code:
Code: Select all
$recordID = $_GET['recordID'];
$domain = GetHostByName($REMOTE_ADDR);
$db = mysql_select_db($database_my_stats, $my_stats) or die (mysql_error());
$sql = "insert into popup values ('', '$recordID', now(), '$domain')";
mysql_query($sql, $my_stats);This does give me an interesting quirk that I think may be caused by my router. I (and a friend of mine) am getting two entries in the db every time (after the first one or two hits) we open the pop up page.
I'd really rather not put an entry into the db every time the page is called. I saw some tutorials on the web that said to do just that, but I can only imagine the bloated db that would make.
What I was trying to figure out, before settling on this solution was this. I'll write it in half code/half english...
$recordID = the NAME
IF
record exists for NAME in STATS db
do this
UPDATE HITS where NAME=NAME by adding 1(++1)
ELSE
insert into STATS values (' ', '$recordID', '++1')
This is using a db with the fields 'id', 'name', 'hits'.
Is this the right way to go about getting some very simple stats?
I plan on using a similar solution when measuring our random ad impressions.
Steve