Re: Dumping file in to MySQL via PHP

From: Date: Mon, 06 Nov 2000 09:38:15 +0000
Subject: Re: Dumping file in to MySQL via PHP
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-4230@lists.php.net to get a copy of this message
"Vojtech Dvorak" <vojtech_dvorak@servind.cz> schrieb in im Newsbeitrag: 015f01c047ca$42968320$1801a8c0@monitdvorak... > Hi Michael, > sorry I didn't make my self clear... > Please see my comments in text below. > > > Hi Vojtech, > > > > As usual, I don't quite understand exactly how your doing all this. > > But this is a good thing I need to do for my admin pages. > > > > Vojtech Dvorak wrote: > > > > > > Dear all, > > > I have problems with dumping file made by mysqldump to MySQL database on > our > > > web server via PHP script. > > > For updating that web server we can use just PHP (so I can't use > mysqlimport > > > etc.) > > > I have nicely created dump file with complete inserts etc. > > > Than I save file in to web server... > > > > Did you save the file to the server with php code, ftp, telnet? > > I have AutoFTP daemon running on my local server that is capable of sending > files through FTP in exactli given times. > > > > > > ...and want to run PHP script which will > do > > > all orders in that dump file... > > > > Are you familiar with this form of a mysqldump command? > > > > mysqldump my_db | mysql -h other.server.com my_other.db > > > > of course you'll need to take care of user name and password some how. > > But this will dump directly into your other server. > > > > Also. Just in case you haven't ran into this yet, read up on the > > --add-drop-table option. > > > > Yes I am familiar with these commands (I am making my dump file with this > ;-) ) > But I can' access directly to remote MySQL. Our provider allows update only > by PHP scripts.... > > So what I need is PHP script that will take dumpfile (previously saved by > AutoFTP prog. to remote server) and do update of MySQL. > > Easy, but how do I do it? > Thanks Vojtech Hello, if $lFile is the result of mysqldump the following executes $lFile on your mysql db. $os = system("mysql -h $DBHost --password=$DBPassword -u $DBUser $DBDatabase < data/".$lFile); read documentation of php function system() and mysql for additional information. This is a PHP script, so your provider must allow it, since he 'only allows update by PHP scripts' ;-) Good luck. Heiko Dittrich -- heiko@love.de

« previous php.db (#4230) next »