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);
}
}