Row inserts twice with one load
<p>I have been stuck on this for a while and can't figure it out.</p>

<p>I use this code to record visits and everytime the page is loaded once it inserts two rows, 1 unique and 1 non unique, how is that?</p>

<pre><code>$check = mysql_query("SELECT ip FROM visits WHERE ip = '{$_SERVER['REMOTE_ADDR']}'");
$num= mysql_num_rows($check);
if ($num&lt; 1){
mysql_query("INSERT INTO visits VALUES('','{$_SERVER['REMOTE_ADDR']}','1')");
}else{
mysql_query("INSERT INTO visits VALUES('','{$_SERVER['REMOTE_ADDR']}','0')");}
</code></pre>

<p>I know its not the best script to count visits because of ip changes and such but thats a different story, just wondering why this inserts twice on a page load</p>

<p>When i move the code to a separate file without any HTML to test it with fake ip and such it works, what kind of html on the page could cause this?</p>
