用户
 找回密码
 入住 CI 中国社区
搜索
查看: 8733|回复: 31
收起左侧

[HELP] 求CI后台进行数据库备份还原的例子

[复制链接]
发表于 2010-10-15 14:05:59 | 显示全部楼层 |阅读模式
如题,在线等
发表于 2010-10-15 14:49:17 | 显示全部楼层
 楼主| 发表于 2010-10-15 14:56:36 | 显示全部楼层
不是这个哦 我是需要用CI写的数据库备份 我用手册上面的列子 但是备份却数据库‘损坏
发表于 2010-10-15 15:00:14 | 显示全部楼层
你把原文的错误提示放上来看看。
发表于 2010-10-15 15:05:26 | 显示全部楼层
回复 3# ahkxhyl

CI执行可能受到配置文件的限制。根据错误提示可以对查找问题有帮助
 楼主| 发表于 2010-10-15 15:19:56 | 显示全部楼层
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''<span class=\"Apple-style-span\" style=\"font-family:verdana, arial, helvetica,' at line 1
[Err]
发表于 2010-10-15 15:47:08 | 显示全部楼层
这么写写看
class Db_manage extends Controller{
        function Db_manage()
        {
                parent::Controller();
                $this->load->dbutil();
                $this->load->helper('file');
        }
        function back_up()
        {
                $backup =& $this->dbutil->backup();
                write_file('/uploads/db/', $backup);
                $this->load->helper('download');
                force_download('mybackup.gz', $backup);
    }
}
发表于 2010-10-15 15:49:13 | 显示全部楼层
还原就做个文本域读到文件然后执行SQL就算还原好了。
 楼主| 发表于 2010-10-15 16:03:52 | 显示全部楼层
谢谢 还是错误哦 文本域读到文件 这个怎么做哦 能写给我学习下吗 谢谢
发表于 2010-10-15 16:11:21 | 显示全部楼层
你的数据库什么版本的?

本版积分规则