Here is my PHP Code:
$con = mysql_connect($mysql_host,$mysql_user,$mysql_password);
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db($mysql_database, $con);
if(isset($_GET['lost'])&&$_GET['lost']=='lost'&&isset($_GET['name'])){
mysql_query("INSERT INTO Losers (Name, Date) VALUES('$_GET[name]',NOW())");
}
mysql_close($con);
What is happening is that for each time someone submits the form, MySQL is inserting three records: their name, an image src within a canvas script, and the src of my favicon.
Why in the world would this happen?
UPDATE
I’ve changed the $_GET variable to an unchanging string: ‘Ben’. Now it just puts ‘Ben’ in three times. Why is it performing the sql function three times?
SOLVED
My .htaccess file was redirecting all images to index.php. I was trying to make SEO friendly URLs but I needed to fix the relative src values in my images.
You are probably redirecting all requests to your php file. It’s triggered once for the actual request, your browser asks for favicon automatically and the 3rd is either css, js or something.
If you use apache, check your htaccess file.