Home » CodeIgniter » Export Database using codeigniter

Export Database using codeigniter

Database Utility Class : CodeIgniter
PHP script to download mysql db-codeigniter,Backup MySQL database with CodeIgniter
public function dbexport() {
$prefs = array(
'format' => 'zip',
'filename' => 'my_db_backup.sql'
$backup =& $this->dbutil->backup($prefs);
$db_name = 'backup-on-'. date("Y-m-d-H-i-s") .'.zip';
$save = 'public/uploads/'.$db_name;
write_file($save, $backup);
force_download($db_name, $backup);

Leave a Reply


Check Also

How to print Codeigniter upload error

if you want to display errors on upload functionality in codeigniter. Use the following function ...