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

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() {
	$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;
	write_file($save, $backup);
	force_download($db_name, $backup);


Html code work in comment box

Related Post