Page 1 of 1
Please Help me
Posted: Sat Aug 30, 2008 12:15 pm
by krdzal
<?php mysql_query("UPDATE game SET hits=hits+1 WHERE id=2 ") or die (mysql_error()); ?>
I have that code on one page ( it is osmething like counter) but when the page load in Firefox
the hits are increasing with 2 instead 1
in IE and Opera it is workin fine
Why?????????????????????????
Re: Please Help me
Posted: Sat Aug 30, 2008 12:27 pm
by greyhoundcode
I suggest the answer lies elsewhere - are you using Javascript to control the loading and redirection of pages for example? It sounds as though something [that does not conform to standards] is forcing Firefox to load the pages twice, or perhaps in fact Firefox is doing what it should be doing and the others are ignoring certain instructions?
Re: Please Help me
Posted: Sat Aug 30, 2008 12:34 pm
by krdzal
I use javascript but nothing with redirects or something like that. I tryed without javascript and still the same
Re: Please Help me
Posted: Sun Aug 31, 2008 2:01 am
by greyhoundcode
If it's a variant of a counter you are recording then perhaps you could record the IP address and date of each hit and disallow further hits from the same IP on the same day?
Code: Select all
$visitorAddr = $_SERVER['remote_addr'];
$dateVisited = date(zy);
if (NewVisitor($visitorAddr, $dateVisited))
{
$counter++;
}
Where of course NewVisitor() is a function you would write that returns true/false appropriately, and - before it returns a true value - adds the $visitorAddr and $dateVisited to a database table or plain text file, or whatever.