【发布时间】:2013-06-12 06:00:34
【问题描述】:
我正在使用 Codeigniter Active Record 类
我正在尝试在多个表中为特定 ID 创建空记录。例如,假设我的用户的 ID 为 $user_id,而我想要 create empty records in tables T1, T2 and T3。我遇到问题的代码是:
// Store the select statement in cache
$this->db->start_cache();
$this->db->set('user_id', $user_id);
$this->db->stop_cache();
// Insert empty record in tables related to user
$this->db->insert('T1');
$this->db->insert('T2');
$this->db->insert('T3');
$this->db->flush_cache();
在表 T1 中插入了一条空记录,但随后出现错误:
您必须使用“set”方法来更新条目。
编辑: - 显然,表 T1, T2 & T3 有 user_id 列。
我做错了什么,我该如何解决?我是 codeigniter 的新手,CI 文档对此问题并不清楚。
【问题讨论】:
标签: php codeigniter