blakekr Posted January 29, 2007 Share Posted January 29, 2007 Okay, I understand the idea of the "insert into... select..." statement,and the idea of the mysql_select_db function ...but I still can't figure out how to take a few rows in table Foo in database A and copy them into table Foo in database B.Your help appreciated! Link to comment https://forums.phpfreaks.com/topic/36212-copying-row-from-one-table-to-another-and-one-database-to-another/ Share on other sites More sharing options...
artacus Posted January 30, 2007 Share Posted January 30, 2007 So say your selected database is A (mysql_select_db('A',$conn)).If the databases are on the same server, it's pretty easy:INSERT INTO b.foo ...or from "B":INSERT INTO foo ... SELECT * FROM a.fooIf the db's are on different servers, you'll have to use PHP to establish a connection to both and extract and insert the data manually. Link to comment https://forums.phpfreaks.com/topic/36212-copying-row-from-one-table-to-another-and-one-database-to-another/#findComment-172516 Share on other sites More sharing options...
blakekr Posted January 30, 2007 Author Share Posted January 30, 2007 Aha, thanks so much!! Will try (and mark resolved if I don't have more questions) Link to comment https://forums.phpfreaks.com/topic/36212-copying-row-from-one-table-to-another-and-one-database-to-another/#findComment-172977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.