load->dbutil(); $filename = "backupDBOIS_" . date( 'YmdHis' ); $prefs = [ 'tables' => [], // Array of tables to backup. 'ignore' => [], // List of tables to omit from the backup 'format' => '', // gzip, zip, txt 'filename' => NULL, // File name - NEEDED ONLY WITH ZIP FILES 'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file 'add_insert' => TRUE, // Whether to add INSERT data to backup file 'newline' => "\n" // Newline character used in backup file ]; $backup = $this->dbutil->backup( $prefs ); // Load the download helper and send the file to your desktop $this->load->helper( 'download' ); force_download( $filename . '.sql', $backup ); } }