I've been php coding for a long time and have never seen anything like this. I recently changed web hosts and have started seeing some of my scripts running two or three times when they should only run once. But, it only seems to happen when there is a header(Location) kind of redirect.
If I comment out the redirect, the script will run once as it should, but if I leave in the redirect, it will run two or three times before redirecting.
How I know this is that the script inserts information into an SQL database and will insert two or three duplicates of the information.
I created a simple test of it at www.realitychurchweb.net/test1.php
The script for that page is:
require_once("handlers/connection.php");
mysql_query("INSERT INTO AA_GENERIC (name, value)VALUES('testing', '123')");
header("Location: test2.php");
The script for test2.php is:
require_once("handlers/connection.php");
$q = mysql_query("SELECT * FROM AA_GENERIC WHERE name = 'testing'");
$num = mysql_num_rows($q);
echo "There are now $num rows<br /><br />";
If I type in the URL to a browser (Safari) it will enter 1, 2, or 3 rows before redirecting to test2, which then shows how many rows now exist.
I spoke with the tech support of the web host and they were of no help. I'm really at a loss with this one.