Re: Opening more than one database at a time?

From: Date: Mon, 21 Jan 2002 02:11:40 +0000
Subject: Re: Opening more than one database at a time?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-81310@lists.php.net to get a copy of this message
Not sure, the tables are in different databases with different users and passwords. I will look into it but the answer I got this afternoon satisfied me :) Jeff ----- Original Message ----- From: "Miles Thompson" <milesthompson@ns.sympatico.ca> To: "Jeff Lewis" <jeff@hyrum.net>; <php-general@lists.php.net> Sent: Sunday, January 20, 2002 8:51 PM Subject: Re: [PHP] Opening more than one database at a time? > 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 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 > > > > > > > >-- > >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 > > > >

« previous php.general (#81310) next »