Skip to content
Advertisement

codeigniter sql backup works fine in local server but in live it shows error

A PHP Error was encountered Severity: Notice

Message: Only variables should be assigned by reference

**this is my controller code **

public function data_backup()
{
    $this->load->dbutil();
    $prefs = array('format' => 'zip','filename' => 'nirmithi.sql');
    $backup =& $this->dbutil->backup($prefs); 
    $db_name = 'backup-on-'. date("Y-m-d-H-i-s") .'.zip';
    $save = 'Backup/'.$db_name;
    $this->load->helper('file');
    write_file($save, $backup); 
    $this->load->helper('download');
    force_download($db_name, $backup);
}

Advertisement

Answer

Remove & in this line try it

$backup = $this->dbutil->backup($prefs); 
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement