"Tony" <tony@ttiger.co.uk> wrote: [...]
$resource1 = mysql_connect($db_host, $db_user1, $db_pw1)or die ('I cannot connect to the database because: ' . mysql_error());;
//select query to get all the data from resource 1 mysql_select_db ($db_name1)or die("Unable to select database $db_name1"); $sql = "SELECT * FROM $table1"; $query = mysql_query($sql, $resource1); for ($i=0;$i<($result = mysql_fetch_assoc($query));$i++)
This for appears to have no {}d body so the next single statement gets looped:
//insert data into $resource2 $resource2 = mysql_connect($db_host, $db_user2, $db_pw2)or die ('I cannot connect to the database because: ' . mysql_error());;
so that's connecting to the database count(*) times without disconnecting, which probably isn't what you wanted to do!
mysql_select_db ($db_name2)or die("Unable to select database $db_name2"); {
I think the for() above should be just before this open-brace. Also, I think you should be clearer with all mysql_select_db and mysql_query commands which $resource they should work on. PHP says it will use the last mysql_connect()d resource, but that way madness lies.
mysql_query("INSERT INTO $table2"); }
mysql_close($resource1); mysql_close($resource2);
?>
You do know I want danger money for the mental anguish of PHP? Hope that helps, -- MJ Ray - see/vidu http://mjr.towers.org.uk/email.html Webmaster/web developer, statistician, sysadmin, trainer, koha dev, GNU/Linux, debian, gobolinux, gnustep, online shops, mailing lists. Near Weston-super-Mare, Somerset, England. http://www.ttllp.co.uk/