I'm trying to migrate data from an old, poorly designed database to a new one using a php script.
I don't know if I'm just not using mysql_select_db correctly or what.
the old database is called 'od'
the new one is 'resource_centre'
my code is:
$od_con = mysql_connect('localhost','od','dialogue');
if ( mysql_select_db('od',$od_con) ) {
print "od_con selected od<br>";
}
$rc_con = mysql_connect('localhost','od','dialogue');
if ( mysql_select_db('resource_centre',$rc_con) ) {
print "rc_con selected resource_centre<br>";
}
//Go through each link from the original (od) database:
$query = "SELECT id, name_english, name_french, url_english, url_french,
description_english, description_french,
both_lang_english, both_lang_french
FROM link";
if ( ! $link_result = mysql_query($query, $od_con) ) {
print mysql_error() . "<br>";
}
both mysql_select_db calls return true
however, I get an error with the query, which I want to being querying the 'od' database (hence the use of $od_con) but it's apparently querying the resource_centre database (since if I comment out the second mysql_select_db, the query works).
I need to do inserts into the resource_centre database for each row in the od table.
Any thoughts?