Forum Moderators: coopster
$.ajax({
url: 'DatabaseBakup.php',
data: str,
success: function(data) {
$('#showMessage').html(data);
}
}); <?php
//Show errors
error_reporting(E_ALL);
ini_set('display_errors', 'On');
ini_set('html_errors', 'On');
//$database=$_GET[db]; call in progress through $.ajax
$dir="/home/rick/DB-Web"; // for testing
$database="accounts"; // ditto
$format="m.d.y_G.i.s"; // month, day, year _ hr, min, sec
$filename=$dir."/$database". "/".strtoupper ($database)."_DUMP_". date($format).".sql.gz";
$command ="mysqldump --host='localhost' --user='rick' --password='#*$!x' $database > $filename";
exec($command);
//`/usr/bin/mysqldump -urick -prick $database | gzip > $filename`; // other calls - that don't work
// `mysqldump -urick -prick $database > $filename`;
echo "File is stored in: ". $filename;
?>
$dir="/home/rick/DB-Web"; // for testing
//$database="accounts"; // ditto
$database="contacts"; // ditto
$format="m.d.y_G.i.s"; // month, day, year _ hr, min, sec
$filename=$dir."/$database". "/".strtoupper ($database)."_DUMP_". date($format).".sql.gz";
$command ="mysqldump --host='localhost' --user='rick' --password='rick' ".$database." | gzip >". $filename;
$bu_result = system($command);
if ($bu_result) {
error("could not make backup: $bu_result");
}