我在模型中有返回数据的代码
$this->db->select('title, content, date');
$where = "name='Joe' AND status='boss'";
$this->db->where($where);
$query = $this->db->get('mytable');
return $query->result();
我正在使用手册where
我想知道是否允许手动更新和可能删除的概念。
此代码基于单个更新表where
状况
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->where('id', $id);
$this->db->update('mytable', $data);
codeigniter 中允许这样做吗
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$where = "id=$id, name='Joe' AND status='boss'";
$this->db->where($where);
$this->db->update('mytable', $data);
根据 CodeIgniter 中的文档Where,你必须在这里提到OR
or AND
"id=$id, name='Joe'
.
$where = "id=$id AND/OR name='Joe' AND status='boss'";
^^^^
Chose one
或者使用数组
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)