CodeIgniter Query Result as Straight Array -
i have function in codeigniter model , want put/copy 'active_date' record value 'event_date' (in same row match query). tried give 'event_date' straight value , it's work. have no idea query result. thanks!
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 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); } }
something this:
$query = $this->db->select('active_date') ->from('customer_table') ->where('customer_code', $this->input->post('customer_code')) ->get()->row_array(); $data2 = array('event_date' => $query['active_date']);
Comments
Post a Comment