The second, third, and fourth parameters allow you to set the delimiter
newline, and enclosure characters respectively. By default commas are
used as the delimiter, “n” is used as a new line, and a double-quote
is used as the enclosure. Example:

Permits you to backup your full database or individual tables. The
backup data can be compressed in either Zip or Gzip format.

Note

This feature is only available for MySQL and Interbase/Firebird databases.

Note

For Interbase/Firebird databases, the backup file name is the only parameter.

$this->dbutil->backup(‘db_backup_filename’);

Note

Due to the limited execution time and memory available to PHP,
backing up very large databases may not be possible. If your database is
very large you might need to backup directly from your SQL server via
the command line, or have your server admin do it for you if you do not
have root privileges.

// Load the DB utility class$this->load->dbutil();// Backup your entire database and assign it to a variable$backup=$this->dbutil->backup();// Load the file helper and write the file to your server$this->load->helper('file');write_file('/path/to/mybackup.gz',$backup);// Load the download helper and send the file to your desktop$this->load->helper('download');force_download('mybackup.gz',$backup);

Backup preferences are set by submitting an array of values to the first
parameter of the backup() method. Example:

$prefs=array('tables'=>array('table1','table2'),// Array of tables to backup.'ignore'=>array(),// List of tables to omit from the backup'format'=>'txt',// gzip, zip, txt'filename'=>'mybackup.sql',// 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);$this->dbutil->backup($prefs);