Jump to content

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


baby_lion

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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.