Re: pumping database dump in mysql

From: Date: Sat, 21 Apr 2001 14:05:36 +0000
Subject: Re: pumping database dump in mysql
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49668@lists.php.net to get a copy of this message
If you can do it on the command line why not just use the system function and use the command you would use on the command line..? What you try to do now is to feed the whole dump file to mysql_query.. This will never work because mysql_query will only accept one query at a time and the mysqldump utility which you probably used also adds some comments in the dump file which can't be handled by mysql_query.. If you DO want to do it through PHP try to break the dump file into some array so that all the queries in the dump file are seperated and then make sure that you strip all not SQL data.. It's probably not worth the work... Problem gets easier when you create the dump yourself with PHP... My suggestion is to not work with dump files but to get an second mysql database on another machine and backup your database to that machine.. Makes everything easier, when you have a problem the other database can directly be used to restore the backup and you don't have to search for the dump file.. Sucess.. Bye Bye David > I want to write a script that takes a mysql dump file and pumps it into the > database. > I got the dump in a variable and then did > $res = mysql_query($dumpvariable); > but that doesn't work? I know how to do it on the command line, I just want > to do it in a php script... > thanks for any hints! > Peter > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > http://liga1.com building multiple language/culture websites > http://poorbuthappy.editthispage.com online ethnology, > up&down > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#49668) next »