MySQL PHP Data package Backup Program _php Tutorial

Source: Internet
Author: User
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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.