I have been looking into the user guide which came with CodeIgniter. I became very interested with the dbutil() method. Particularly the following line of code:
If you are lucky enough to have one of the exec(), shell_exec(), system() or passthru() enabled on your server. Maybe you would want to use the following:
public function db_backup()
{
$DBUSER=$this->db->username;
$DBPASSWD=$this->db->password;
$DATABASE=$this->db->database;
$filename = $DATABASE . "-" . date("Y-m-d_H-i-s") . ".sql.gz";
$mime = "application/x-gzip";
header( "Content-Type: " . $mime );
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
// $cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best";
$cmd = "mysqldump -u $DBUSER --password=$DBPASSWD --no-create-info --complete-insert $DATABASE | gzip --best";
passthru( $cmd );
exit(0);
}