Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to Export Database using Codeigniter

by
Category:codeigniter
codeigniter mysql
How to Export Database using Codeigniter

Here I have developed an application in Codeigniter which will help you to take backup as per your wish wnenever you want to take backup. While most web hosting company do a daily backup of a customer’s database and site, relying on them to make backups and provide them at no cost is risky also.

public function export_database() {
	$this->load->dbutil();
	$prefs = array(
		'format' => 'zip',
		'filename' => 'crmdata.sql'
	);
	$backup = & $this->dbutil->backup($prefs);
	$db_name = 'crm-on-' . date("Y-m-d-H-i-s") . '.zip';
	$save = 'assets/database_backup/' . $db_name;
	$this->load->helper('file');
	write_file($save, $backup);
	$this->load->helper('download');
	force_download($db_name, $backup);
}

0 Comments


Html code work in comment box


Related Post