Forum Moderators: coopster

Message Too Old, No Replies

INSERT adding too many entries to database

Not sure why.

         

HughMungus

12:19 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have the following code to add an entry to my visitors table to track referers and what pages they visited, etc.

$sql_ref_update = "INSERT INTO visitors (refdate, referer, refpage, refip) VALUES ('$refdate', '$referer', '$refpage', '$refip')";

if(!mysql_query($sql_ref_update)) die(mysql_error());

I just found that when I do this, where I expect one entry to the databasae, I'm getting three (two of which have are the same IP). I'm assuming that the second IP I'm getting might be a firewall or caching server but why two entries for the one IP on one visit?

UPDATE: I found that one of the IP "visitors" is caused by the Google toolbar being on. I didn't know that the toolbar counted as a referer. Why is this? Is this well known because I didn't know about this until now.

TIA

timster

12:34 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's hard to imagine how that SQL query could insert more than one line. Are you sure the query is not being executed multiple times?

HughMungus

12:38 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I updated the post. It turns out that the second IP I'm seeing is the Google toolbar. I didn't know it counted as a separate IP for logging...