Hi,

I have the following code which I use to make regular backups of my databases. Is there a way to have all backup files sent at once after they are created, istead of presenting the list of files available for download?

db_connect($dbuser, $dbpassword, $dbdatabase);

// Lock and flush tables before backup
$query = "LOCK TABLES un_article READ, un_article_writer READ";
$result = mysql_query($query)
or error(mysql_error());
$query = "FLUSH TABLES";
$result = mysql_query($query)
or error(mysql_error());

// Perform backup
$query = "BACKUP TABLE un_article, un_article_writer TO 'c:/web/un/backup'";
$result = mysql_query($query)
or error(mysql_error());

// Unlock tables
$query = "UNLOCK TABLES";
$result = mysql_query($query)
or error(mysql_error());

// Present all files with link to download
if ($handle = opendir('/web/un/backup')) {
echo "Files:<br>\n";
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) { echo "Download $file <a href='backup/$file'>here</a><br>\n";
}
closedir($handle); }


--
anders thoresson

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to