[PHP] dumping mysql database with php script

2002-09-02 Thread rdkurth


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: localhostDatabase: testdata1
#
# Server version3.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:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] dumping mysql database with php script

2002-09-02 Thread Petre Agenbag

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, [EMAIL PROTECTED] 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: localhostDatabase: testdata1
 #
 # Server version3.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:[EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re[2]: [PHP] dumping mysql database with php script

2002-09-02 Thread rdkurth

Hello Petre,
There is more than one database to back up so every time it runs
through the while loop it is suppose to back up the next database and
it changes the name of the text file it is sending it to.

I have already tried just doing one database without the while loop
and I get the same results.
So it is not an over writing  problem
But Thanks anyway

Monday, September 02, 2002, 12:51:12 AM, you wrote:


PA put the exec(...) line OUTSIDE the while loop.As your codeis now, it's
PA dumping with each new row , so i'ts overwriting itself.

PA On Mon, 2002-09-02 at 09:47, [EMAIL PROTECTED] 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: localhostDatabase: testdata1
 #
 # Server version3.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:[EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




-- 
Best regards,
 rdkurthmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re[2]: [PHP] dumping mysql database with php script

2002-09-02 Thread rdkurth



I figured it out it was a permission problem with database username and
password

Monday, September 02, 2002, 12:51:12 AM, you wrote:


PA put the exec(...) line OUTSIDE the while loop.As your codeis now, it's
PA dumping with each new row , so i'ts overwriting itself.

PA On Mon, 2002-09-02 at 09:47, [EMAIL PROTECTED] 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: localhostDatabase: testdata1
 #
 # Server version3.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:[EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




-- 
Best regards,
 rdkurthmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] dumping mysql database with php script

2002-09-01 Thread rdkurth


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: localhostDatabase: testdata1
#
# Server version3.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


$sql=Select * from datba where domname = '$domname';
$results=safe_query($sql);
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:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php