Opening more than one database at a time?
| From: | Jeff Lewis | Date: | Sun, 20 Jan 2002 23:20:25 +0000 |
| Subject: | Opening more than one database at a time? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81290@lists.php.net to get a copy of this message | ||
I am trying to basically copy data from one database to another and am
wondering if it is possible to have more than one database open at a time.
So for example, I want to do something like this but am wondering if there
is a better way:
$dbcon = mysql_connect($db_server, $db_user, $db_passwd); //Make source
connection
mysql_select_db($db_name);
//Select source db
$source_result = mysql_query("SELECT * FROM users"); //Select all
info from users table
while ($row_cat = mysql_fetch_array($result)){
//Loop through and insert into new db
//Insert into new database
}
So where I have "Insert into new database" this is where I want to take some
of the information from the source and insert into the new database (which
uses a different user name and password as well).
Any help would be greatly appreciated :)
Jeff