Jump to content

Archived

This topic is now archived and is closed to further replies.

baby_lion

why my sqldump returns a blank file... sigh~~

Recommended Posts

I am all confused here. My code write as such;

#!/usr/local/bin/php -q
<?php

set_time_limit(0); 

$DB_HOST = "localhost";
$DB_USERNAME = "";
$DB_PASSWORD = "";
$DB_NAME = "someDb"; 

$LOCAL_DUMP_PATH = "C:/apache/htdocs/";   
$FILENAME_PREFFIX = "sqldump";           

$filename = $FILENAME_PREFFIX.date("YmdHis").".sql";

$dump_cmd = "mysqldump -h$DB_HOST -u$DB_USERNAME -p$DB_PASSWORD";

if ($DB_NAME == "all" || $DB_NAME = "ALL") {
  $dump_cmd .= " --all-databases";
} else {
  $dump_cmd = " $DB_NAME";
}

$dump_cmd .= " > $LOCAL_DUMP_PATH$filename"; 
exec($dump_cmd); 

echo "Data has been backed up!!!";
?>

 

This code certainly creates the file, but the files were blank! Please anyone xplain this to me...thanks..

btw, I'm using phpmyadmin 2.5.0..

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.