Sometime when you developing website then it need to be back up database no matter if your client knows how to backup from cpanel but if they don't know you need to make some function on it !
Here is my href menu
by looking controller we know why it will be, then here is my controller
template->load('template','user/user'); } public function backup() { $this->load->dbutil(); $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 = 'pathtobkfolder/'.$db_name; $this->load->helper('file'); write_file($save, $backup); $this->load->helper('download'); force_download($db_name, $backup); } }
and click then menu then system will export database in zip file inside it you get ekstensiton .sql
Share it if this help you, Thanks for visiting me !
Happy Coding
No comments:
Post a Comment