Mysqlphp data packaging and backup program _ PHP Tutorial

Source: Internet
Author: User
Mysqlphp data packaging backup program. Mysqlphp data packaging backup program if (! $ Dbname) {$ errmsgPleaseinputdbname;} else {dbconn ($ dbhost, $ dbuser, $ dbpass, $ dbname, $ charset, $ dbport); if (! File_exists ($ mysqldl 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 object 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 a timestamp to indicate truncation to avoid incomplete reading of The _ angel_11111111_eof _ file.
Q ("load data local infile '". addslashes ($ mysqldlfile ). "'into TABLE tmp_angel fields terminated by '_ angel _ {$ timestamp} _ eof _' escaped by'' lines terminated by '_ angel _ {$ timestamp} _ 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.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445024.htmlTechArticlemysql php Data packaging backup program if (! $ Dbname) {$ errmsg = 'Please input dbname';} else {dbconn ($ dbhost, $ dbuser, $ dbpass, $ dbname, $ charset, $ dbport); if (! File_exists ($ mysqldl...

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.