Re: Downloading Database?!?!
| From: | Joseph Szobody | Date: | Wed, 23 Jul 2003 14:23:21 +0000 |
| Subject: | Re: Downloading Database?!?! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29430@lists.php.net to get a copy of this message | ||
Brenton,
This is how I do it:
<?php
$filename = "db_backup_" . date("n-j-y");
header("Content-Disposition: filename=$filename.sql");
header("Content-Type: application/force-download");
exec("mysqldump -c -q " . DATABASE_NAME . " -u username -ppassword
--add-drop-table", $sql);
for($i = 0; $i < count($sql); $i++) {
echo $sql[$i] . "\r\n";
}
?>
Joseph
"Brenton Dobell" <brenton@lefevrehs.sa.edu.au> wrote in message news:ANECJPFIMPHFOJPGHDEBKEDICCAA.brenton@lefevrehs.sa.edu.au...
> Hello all,
>
> I am developing an Intranet page for my workplace, ATM i use phpmyadmin to
> do rutine backups ect, this is cool but i am going on long service leave for
> 14 weeks and during that time a new guy will attempt to continue to maintain
> the site and perform regular "backups"... I tried to show him how to use
> phpmyadmin but has proved too dificult for him to understand, how can i make
> a quick script to implement into a page that prompts you to download the
> entire sctipt in .txt form?? just like php myadmin, and starting tips and
> hints would be great.
>
>
> Cheers in advance
>
> Brenton
>