I cannot get the following to work when calling through $.ajax().
Code: Select all
`mysqldump -urick -prick $database | gzip > $filename`
If I run DatabaseBakup.html which calls DatabaseBakup.php via $.ajax() the DUMP is not successful. I use the exact same code in DatabaseBakup.php as I do in bakup.php, in fact the code is copied from bakup.php to DatabaseBakup.php .
This makes no sense to me, I hope someone can explain what I am doing wrogn
Thanks in advance for any help, Rick P.
DatabaseBakup.html:
Code: Select all
<script type="text/javascript" >
var database=unescape(getUrlParametersVals()['db']);
function bakitup(database) {
var str='db='+encodeURIComponent(database);
$.ajax({
url: 'DatabaseBakup.php',
data: str,
success: function(data) {
$('#showMessage').html(data);
}
});
}
</script>
Code: Select all
?php
set_include_path( 'include' );
error_reporting (E_ALL ^ E_NOTICE);
$dir="/home/rick/DB-Web";
$database="contacts";
$format="m.d.y_G.i.s"; // month, day, year _ hr, min, sec
$filename=$dir."/$database". "/".strtoupper ($database)."_DUMP_". date($format).".sql.gz";
`mysqldump -urick -prick $database | gzip > $filename`;
echo "File is stored in: ". $filename;
?>
Code: Select all
<?php
set_include_path( 'include' );
error_reporting (E_ALL ^ E_NOTICE);
$dir="/home/rick/DB-Web";
$database="contacts";
$format="m.d.y_G.i.s"; // month, day, year _ hr, min, sec
$filename=$dir."/$database". "/".strtoupper ($database)."_DUMP_". date($format).".sql.gz";
`mysqldump -urick -prick $database | gzip > $filename`;
echo "File is stored in: ". $filename;
?>