It's not the submit button being pressed twice because it's an administrative tool that only I use! Here is the code with certain things edited out for security:
PHP Code:
else if ($step == 3)
{
$sql = str_replace("\\", "", $sql);
$commands = explode(";", $sql);
for ($x = 0; $commands[$x]; $x++)
mysql_query($commands[$x]);
//// LARGE PORTION EDITED OUT
redirect();
}
I edited out a large portion, but the mysql_query you see above is where the problem occurs. $sql is valid sql passed from the previous page. What happens is I will run the script and I'll notice that it executed all the SQL commands twice or more. So, I delete those rows in the DB manually and then run the exact same script again and BINGO it works. Today I decided to post about it because it did the double insert thing like 10 straight times and was getting on my nerves, but on the 11th time it worked properly.
Bookmarks