ghqtsy 发表于 2010-2-4 12:10:37

关于快捷插入(insert)函数

使用mysql数据库,使用下列函数时,出现错误.
Fatal error: Call to undefined method CI_DB_mysql_driver::insert() in C:\www\mobile\branches\0.1\application\libraries\M0101.php on line 78
是不是mysql数据库不能使用这个函数?

$data = array(
               'title' => $title,
               'name' => $name,
               'date' => $date
            );

$this->db->insert('mytable', $data);

Hex 发表于 2010-2-4 13:01:11

类库里不能直接 $this->db
请使用 get_instance() 取 CI 超级对象

ghqtsy 发表于 2010-2-4 13:50:00

我不是在类库中使用,我是直接在控制器中使用的.

Hex 发表于 2010-2-4 14:53:04

那肯定是可以使用的,楼主是不是禁用了 Active Record?

ghqtsy 发表于 2010-2-4 20:09:13

是禁用了

visvoy 发表于 2010-2-4 23:05:04

禁用就没有这些指令了
页: [1]
查看完整版本: 关于快捷插入(insert)函数