PDA

View Full Version : Exporting/Importing table from MySQL with help of PHP files.


wooolF[RM]
17 Mar 2002, 14:47
Hello all :)

Well... First want to say many thanx to FireFly for all help he have provided and for all his answers :)

I got a lil problem here. I must export table "templates" from MySQL database on the server where I have not installed myadmin yet and I don't have telnet access to it. So I must use PHP files to connect to the database and dump only one table from there (I'll download it after from FTP).

After that I must import it in another database. Just override old table. I don't know if I need to drop it first or I can just override it. I can use telnet/ftp/myadmin there with that MySQL database. So I will be very appreciated if u could paste the string I have to run to get that dumped table imported.

As u see I need to export a table with help of PHP file and then import that dumped table with help of telnet/myadmin/PHP file.

Please help if u can.

Thanx very much :)

wooolF[RM]
17 Mar 2002, 15:06
<?
mysql_connect("host","login","pass");
$query = "DUMP TABLE template FROM DATABASE databasenamehere";
$result = mysql_query($query);
?>

??? like that ???

wooolF[RM]
17 Mar 2002, 16:38
wroooooooooooom

wooolF[RM]
18 Mar 2002, 12:40
really no one? :(

wooolF[RM]
19 Mar 2002, 09:52
can something like this do the job:


<?
system ("mysqldump -u from_username_from -pfrom_password -h from_host
from_db from_table | mysql -u to_user -pto_pass -h to_host to_db_name");
?>


Meaning of it is if I wish to copy the table to a completely different server.

nsr81
19 Mar 2002, 11:31
Hi there Woolf,

If it is a one time thing then I'd use phpMyAdmin to dump the table/db and get an sql script which you can run on your second server. If not, may be some one else can offer an opinion :)

wooolF[RM]
19 Mar 2002, 11:38
well.. I have dumped table allready from one server... now I just need to be sure that commands I gave before are right ones :)

wooolF[RM]
19 Mar 2002, 14:22
thanx for help support... sorted it out myself...