Re: Getting empty .sql file when we run backup code please see the code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use:

$command="mysqldump --user=$dbuser --password= $dbpass $dbname > $filename.sql";


 Thanks & Regards
Udayakumar Sarangapani
Sr. PHP Developer
CompIndia Infotech Pvt. Ltd.
Chennai.

"Science is nothing but logic..."




----- Original Message ----
From: malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Wednesday, 9 July, 2008 8:45:33 PM
Subject:  Getting empty  .sql file when we run backup code please see the code


Hi Guys

i have the code for  taking the database backup when i run the code i
am getting empty file with out tables. fallowing is my code please
provide some help.

<?php

$dbname = 'bulksms' ;
$dbuser = 'root';
$dbpass = '';
$dbhost = 'localhost'; ;

$connect=mysql_ connect($ dbhost,$dbuser, $dbpass);
mysql_select_ db($db);
//echo "jumbedb selected";
mysql_select_ db($dbname) or die("cannot select DB");

//$backupFile = $dbname . date("Y-m-d- H-i-s") . '.sql';
$backupFile = $dbname.'.sql' ;

/*
header('Content- Description: File Transfer');
header('Content- Type: application/ force-download' );
header ("Content-Type: application/ octet-stream" );
header("Content- Length: ".filesize(" $folder/$ file"));
header('Content- Disposition: attachment; filename=' . $file);
readfile("$folder/ $file");
*/
// mysqldump ---user admin ---password= $dbpass mydatabase > sql.dump

//$command = "mysqldump --opt -h $dbhost -u $dbuser
--password=$ dbpass $dbname > $backupFile" ;
//$command = "mysqldump --opt -h $dbhost -u $dbuser
--password=$ dbpass $dbname";
$command="mysqldump ---user $dbuser ---password= $dbpass $dbname"; 
//echo "command is".$command;
exec($command, $retval);

$user_agent = strtolower ($_SERVER["HTTP_ USER_AGENT" ]);

if ( (is_integer (strpos($user_ agent, "msie"))) && (is_integer
(strpos($user_ agent, "win"))) ){
//header('Cache- Control: must-revalidate, post-check=0,
pre-check=0' );
//header('Pragma: public');
//header('Content- Type: xxx/null'); 
//header('Content- Disposition: attachment; filename="' . $backupFile
. '";');
} else {
//header('Content- Type: application/ octet-stream' );
//header('Content- Disposition: attachment; filename="' .
$backupFile . '";');
//header('Pragma: no-cache');
}
header('Content- Description: File Transfer');
header('Content- Type: application/ force-download' );
header ("Content-Type: application/ octet-stream" );
header('Content- Disposition: attachment; filename=' . $backupFile) ;
//header('Content- Length: ' . strlen($retval) );
//readfile($ backupFile) ; 
//print_r( $retval);
foreach($retval as $val)
echo $val."\n";

?>

    


      Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux