I have this code here that updates an entry, adds one to whatever site sent me a surfer
$query="UPDATE traffic_in SET amount_ = amount_ + 1 WHERE referer_ = '$url' AND time_='$todaystime' AND unique_ = '$unique_'";
$result = mysql_query($query) or die(mysql_error());
When I run only the php script containing this code, then a single hit is registered.
However, when I include this in my main page and have that load, it's always 2 hits that are registered and I have no idea why.
Some possibilities here are:
- I included the script two times in the main page. (this was not the case)
- There are two entries for the specific referer so that when I incremented it by one, two of them were incremented and so two hits were counted
(also not the case)
I tried different numbers for the increment. When I put in 3 and just ran the script itself I had 3 hits registered. When I loaded my main page with the script then I had 6 hits registered. Any ideas on what could be causing this?