Error如下所示:
在“where子句”中未知列“辞职_id=‘158’”
UPDATE pr_temporary_absconding_checklists SET completion_status = 'pending' WHEREresignation_id='158' AND checklist_id='4'
我的模型代码是:
function submit_absconding_checklist($post_array, $idss) {
$this->load->database();
$ids = $this->uri->segment(4);
$where = "resignation_id='$ids' AND checklist_id='$idss'";
$this->db->where($where);
$dbdata = array(
"completion_status" => $post_array['completion_status']
);
$this->db->update('pr_temporary_absconding_checklists', $dbdata);
print_r($query);
die;
/**
* if required add this code here to check
*
* echo $this->db->last_query();
*/
return 'Checklist updated successfully';
}
还附上表格图像

发布于 2016-08-25 10:22:19
您可以将查询以活动记录格式写成
$this->db->set("completion_statuscompletion_status", $post_array['completion_status']);
$this->db->where("resignation_id", $ids);
$this->db->where("checklist_id", $idss);
$this->db->update("pr_temporary_absconding_checklists");
$afftectedRows = $this->db->affected_rows();发布于 2016-08-25 10:15:26
删除查询中resignation_id='158'周围的回退。
它应该是这样的:
UPDATE `pr_temporary_absconding_checklists` SET `completion_status` = 'pending' WHERE `resignation_id`='158' AND `checklist_id`='4'模型代码:
function submit_absconding_checklist($post_array, $idss) {
$this->load->database();
$ids = $this->uri->segment(4);
$this->db->where('resignation_id', $ids); // UPDATED
$this->db->where('checklist_id', $idss); // UPDATED
$dbdata = array(
"completion_status" => $post_array['completion_status']
);
$this->db->update('pr_temporary_absconding_checklists', $dbdata);
print_r($query);
die;
/**
* if required add this code here to check
*
* echo $this->db->last_query();
*/
return 'Checklist updated successfully';
}发布于 2016-08-25 10:18:22
试着像这样
$data = array(
'completion_status' => $post_array['completion_status']
);
$this->db->where('resignation_id', $ids);
$this->db->where('checklist_id', $idss);
$this->db->update('mytable', $data);https://stackoverflow.com/questions/39142450
复制相似问题