CodeIgniter framework backup database
Export txt format:
// Load the DB utility class $ this-> load-> dbutil (); // Backup your entire database and assign it to a variable $ backup = & $ this-> dbutil-> backup (array ('format' => 'txt ')); // Load the file helper and write the file to your server $ this-> load-> helper ('file'); write_file ('backup. SQL ', $ backup ); |
Gzip format:
// Load the DB utility class $ this-> load-> dbutil (); // Backup your entire database and assign it to a variable $ backup = & $ this-> dbutil-> backup (); // Load the file helper and write the file to your server $ this-> load-> helper('file'{}write_file('mybackup.gz ', $ backup ); |
Zip format
// Load the DB utility class $ this-> load-> dbutil (); // Backup your entire database and assign it to a variable $ backup = & $ this-> dbutil-> backup (array ('format' => 'Zip ')); // Load the file helper and write the file to your server $ this-> load-> helper('file'{}write_file('backup.zip ', $ backup ); |