Hi Perch,
I'm guessing you resolved this issue if you've successfully imported all of the records?
The issue is caused by your server dropping the MySQL connection to the page after a few seconds if it hasn't carried out any requests. As it assumes that the page doesn't need to make any calls (I guess this might be happening while your script downloads images).
You can get the script to reconnect to MySQL with the following code:
if (!mysql_ping()) { // check if we're still connected and detect "MySQL server has gone away" timeout errors
//mysql_close(); // if needed - close connect to ensure it gets recreated correctly (even if connection isn't working!)
$GLOBALS['DBH'] = @mysql_connect($GLOBALS['SETTINGS']['mysql']['hostname'], $GLOBALS['SETTINGS']['mysql']['username'], $GLOBALS['SETTINGS']['mysql']['password'], true);
if (!$GLOBALS['DBH']) { die("Error re-connecting to MySQL: $connectionError"); }
mysql_select_db($GLOBALS['SETTINGS']['mysql']['database']);
}
So you'd put this code just after any extremely time consuming tasks. It will check the connection and reconnect if it's been dropped.
Let me know if you have any questions.
Thanks!
Greg
Greg Thomas
PHP Programmer - interactivetools.com