【发布时间】:2014-03-26 21:28:21
【问题描述】:
我似乎无法在用户指南中找到明确的解释。
在 CodeIgniter 活动记录中,要更新表行,似乎需要做三件事:(1) 确定要更新的记录,(2) 定义需要更改的内容和 (3) 提交变化。
不知何故,无论我如何阅读手册,都不清楚。 https://www.codeigniter.com/userguide2/database/active_record.html#update
这似乎暗示“设置”是关于插入 - 这意味着在我的书中向表格中添加行。
而“更新”是关于“改变”现有信息。
对我有用的唯一方法是执行所有三个操作。
像这样:
$this->db->where('id',$userid); //selecting the right user
$this->db->set($SubscriptionChoices); //setting the new values to be written
$this->db->update('userprefs'); //Do it. Update table userprefs
【问题讨论】:
标签: mysql codeigniter activerecord