Re: Opening more than one database at a time?
| From: | Miles Thompson | Date: | Mon, 21 Jan 2002 01:51:55 +0000 |
| Subject: | Re: Opening more than one database at a time? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81307@lists.php.net to get a copy of this message | ||
Jeff,
Can you let MySQL do the work for you, with INSERT ... SELECT? Here's the URL"
http://www.mysql.com/doc/I/N/INSERT_SELECT.html
HTH - Miles Thompson
At 06:20 PM 1/20/2002 -0500, Jeff Lewis wrote:
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 allinfo 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net