RE: A way to duplicate data across databases
| From: | Tim Ward | Date: | Mon, 12 Feb 2001 10:28:47 +0000 |
| Subject: | RE: A way to duplicate data across databases | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-39196@lists.php.net to get a copy of this message | ||
you should be able to query the structure of the database in php/mysql. this
should then give you everything you need to build your create table
statement dynamically so you can build a black-box function that takes
source and target databases and table name. You can proably find the tables
in a database so your function becomes one call database copier.
Tim Ward
Senior Systems Engineer
Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html
> -----Original Message-----
> From: Carsten Gehling [mailto:carsten@sarum.dk]
> Sent: 11 February 2001 21:22
> To: php-general@lists.php.net
> Subject: A way to duplicate data across databases
>
>
> I'm making a script that generates test sites usíng dummy
> data stored in one
> MySql database ("uwebsitebase")
>
> Now, using php-scripting, I'm copying these data to a demo-database
> ("uwebdemo"). The structure is the same - the same tables
> with the same
> fields. Only difference will be that the copied data should
> get new primary
> keys which are auto-incremented. No problem there.
>
> However, the process is tedious. I have tables that contains
> some 30 fields
> and it's just a bore selecting all fields from one table, and
> then writing a
> complete insert statement with all the fields except the PK.
>
> Is there an easier way? Remember 1) It's PHP 2) It's across databases.
>
> I have to script it, since I need the new keys on other places.
>
> - Carsten
>
>
>