实时服务器上的数据库备份出现错误


Database backup on live server gives error

我正在尝试为Codeigniter应用程序备份数据库。我使用了CI用户指南中的代码,如下所示:

public function db_backup()
    {
        $prefs = array(
                'tables'      => array(),  // 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);
        // Load the DB utility class

        // 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('/uploads/mybackup.zip', $backup); 
        // Load the download helper and send the file to your desktop
        $this->load->helper('download');
        force_download('mybackup.zip', $backup);
    }

我在本地服务器上尝试了这段代码,它运行得很好,但当我在实时服务器上尝试同样的代码时,它显示的错误如下:

发生数据库错误

错误编号:1064

您的SQL语法有错误;查看手册与您的MySQL服务器版本相对应,以便使用正确的语法1号线'28e22afcb89a2b83643700c3f2044de'附近

从28e22afcb89a2b83643700c3f2044de 中选择*

文件名:/home/project/controllers/admin/setting.php

线路编号:37

我在这里做错了什么?

在写入此选择查询时,在表名之前和之后添加`。

例如:

SELECT * FROM `28e22aafcb89a2b83643700c3f2044de`