if you want something very rough and ready..
$datestamp = date("d-m-Y"); // Current date to append to filename
include('config.php');
//$rt_dir is defined in config as are the db connection values
// The name (and optionally path) of the dump file
$relative_filepath="$dbName-$datestamp-sql.gz";
$root_filepath= $rt_dir."/foldername/".$relative_filepath;
if (file_exists($relative_filepath)) unlink($relative_filepath);
$command = "mysqldump -u$dbUserLogin -h$dbHost --password=$dbPassword $dbName | gzip > $root_filepath";
$result = passthru($command);
$filename = array_pop(explode("/", $root_filepath));
echo '<a href="'.$relative_filepath.'">'.$filename.'</a>';
//unlink($root_filepath); //delete backup file from the server
the "if file_exists" isn't going to do it's job, but whatever, it's a quick hack
-also after running it, I immediately delete the script off the server