Re: dumping mysql database with php script

From: Date: Mon, 02 Sep 2002 07:51:12 +0000
Subject: Re: dumping mysql database with php script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114881@lists.php.net to get a copy of this message
put the exec(...) line OUTSIDE the while loop.As your codeis now, it's dumping with each new row , so i'ts overwriting itself. On Mon, 2002-09-02 at 09:47, rdkurth@starband.net wrote: > > I am having a problem with a script to dump a mysql database to a text > file. When I run the command below it creates the database.sql file but > it only puts the first three lines in that file they look like this > # MySQL dump 8.13 > # > # Host: localhost Database: testdata1 > #-------------------------------------------------------- > # Server version 3.23.37 > > > If I run the following at the command line it work perfect passing the whole > database to the txt file > /usr/bin/mysqldump -u testdata1 -ptestdata1 testdata1 > > /home/sites/www.directphp.net/sitebackup/databases/testdata1.sql > > Why is it stopping on the third line when I run it with a PHP script > > This is my script > > while($row = mysql_fetch_array($result)){ > $databasename=$row["databasename"]; > $databaseusername=$row["$databaseusername"]; > $databasepassword=$row["$databasepassword"]; > > exec("/usr/bin/mysqldump -u $databaseusername -p$databasepassword $databasename > > $Databasesdir/$databasename.sql"); > } > > > > > -- > Best regards, > rdkurth mailto:rdkurth@starband.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#114881) next »