Home > Article > Backend Development > PHP Mysql database backup program summary_PHP tutorial
We only need to search for N types of database backup class codes on the Internet. Now I will summarize a few good database backups and hope it will be helpful to everyone.
Database backup class
How to use:
The code is as follows | Copy code | ||||
$link = @mysql_connect("localhost","database name","password") or die ('Could not connect to server.'); mysql_query("use cms",$link); mysql_query("set names utf8",$link); $dbbck = new backupData($link);//Instantiate it, just a link identifier is enough //When backing up data, if you want to back up all tables in a database, you can write like this: $dbbck->backupTables("cms","./",array('*')); //When backing up data, if you want to back up only one table in a database, you can write like this: $dbbck->backupTables("cms","./",array('user')); //When backing up data, if you want to back up multiple tables in a database, you can write like this: $dbbck->backupTables("cms","./",array('user','acl','informatoin')); //Note: $dbbck->backupTables("parameter 1", "parameter 2", array());, |
Parameter 1 is: database name,
Parameter 2 is: the location where the backup data is to be stored (i.e. directory address)
The third one is: Which tables do you want to save
backdata.class.php
The code is as follows | Copy code |
/* public function __construct($mysql_link){ |