php-db | 2002122
Date: 12/18/02
- Next message: John 'zariok' Draughn: "[PHP-DB] Re: FW: Oracle connectivity question..."
- Previous message: John W. Holmes: "RE: [PHP-DB] keyword search a mysql database."
- In reply to: Daevid Vincent: "RE: [PHP-DB] How can I use PHP to duplicate a mysql template database? [hack] bug"
- Next in thread: Rick Widmer: "Re: [PHP-DB] How can I use PHP to duplicate a mysql template database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 12/17/02 6:20 PM, Daevid Vincent at daevid <email protected> appended the
following bits to my mbox:
> This method copies the data, but doesn't copy 'Extra' stuff like
> "auto_increment".
I've used the following before:
SHOW CREATE TABLE $tablename
You could probably do something like this.
1) Pick the database (SHOW DATABASES);
2) Create new database
3) List the tables in the database (SHOW TABLES FROM $database)
4) For each table in the database, do the following:
a) SHOW CREATE TABLE $tablename
b) perform the above query on the new database
c) transfer the data
If the databases are on the same server, I think you can do (c) as the
following:
INSERT INTO $new_database.$tablename SELECT * FROM $old_database.$tablename;
If it's a remote server, I think it would require you to do it in PHP
(ouch).
Hope that helps.
Sincerely,
Paul Burney
<http://paulburney.com/>
<?php
while ($self != "asleep") {
$sheep_count++;
}
?>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: John 'zariok' Draughn: "[PHP-DB] Re: FW: Oracle connectivity question..."
- Previous message: John W. Holmes: "RE: [PHP-DB] keyword search a mysql database."
- In reply to: Daevid Vincent: "RE: [PHP-DB] How can I use PHP to duplicate a mysql template database? [hack] bug"
- Next in thread: Rick Widmer: "Re: [PHP-DB] How can I use PHP to duplicate a mysql template database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

