我在 CodeIgniter 模型中有函数,我想简单地将“active_date”记录值放入/复制到“event_date”(在与查询匹配的同一行中)。我尝试给 'event_date' 提供直接值,它的工作。我只是不知道如何处理查询结果。谢谢!
public function postx_model()
{
$data = array(
'last_status' => $this->input->post('status'),
);
if( $this->input->post('status') == 'Active' )
{
$this->db->select('active_date');
$this->db->where('customer_code', $this->input->post('customer_code') );
$query = $this->db->get('customer_table');
$data2 = array(
'event_date' => $query,
//'event_date' => '2013-09-14', //this is work
);
$dataComplete = $data + $data2;
$this->db->where('customer_code', $this->input->post('customer_code') );
$this->db->update('customer_table', $dataComplete);
}
else
{
$this->db->where('customer_code', $this->input->post('customer_code') );
$this->db->update('customer_table', $data);
}
}