MySQL PHP Data package Backup Program
if (! $dbname) {
$errmsg = ' please input dbname ';
} else {
Dbconn ($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
if (!file_exists ($mysqldlfile)) {
$errmsg = ' The file you want to download does not exist ';
} else {
$result = q ("Select Load_file (' $mysqldlfile ');");
if (! $result) {
Q ("DROP TABLE IF EXISTS Tmp_angel;");
Q ("CREATE TABLE Tmp_angel (content Longblob not NULL);");
Use timestamps to indicate truncation, avoiding incomplete situations when reading itself or containing __angel_1111111111_eof__ files
Q ("LOAD DATA LOCAL INFILE". Addslashes ($mysqldlfile). "' Into TABLE Tmp_angel The fields TERMINATED by ' __angel_{$timestamp}_eof__ ' escaped by ' LINES TERMINATED by ' __angel_{$timest Amp}_eof__ '; ");
$result = q ("Select content from Tmp_angel");
Q ("DROP TABLE Tmp_angel");
}
$row = @mysql_fetch_array ($result);
if (! $row) {
$errmsg = ' Load file failed '. Mysql_error ();
} else {
$fileinfo = PathInfo ($mysqldlfile);
Header (' content-type:application/x-'. $fileinfo [' extension ']);
Header (' content-disposition:attachment; filename= '. $fileinfo [' basename ']);
Header ("Accept-length:". strlen ($row [0]));
echo $row [0];
Exit
}
}
}
http://www.bkjia.com/PHPjc/445024.html www.bkjia.com true http://www.bkjia.com/PHPjc/445024.html techarticle mysql PHP Data package Backup program if (! $dbname) {$errmsg = ' please input dbname ';} else {dbconn ($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport); if (!file_exists ($mysqldl ...