Hi Uday we replaced with below code $command="mysqldump --user=$dbuser --password= $dbpass $dbname > $filename.sql"; but geeting same error. On Thu, Jul 10, 2008 at 9:16 AM, Udaya kumar <udayakumaar@xxxxxxxxx> wrote: > 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<malayappa%40nannacomputers.com> > > > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > 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] > > > -- Regards P.M.M.Srinivas jr Software Engineer ID: NGH32053 Ph : +91 9849426596 Home page : www.nannacomputers.com An ISO 9001:2000 company [Non-text portions of this message have been removed]