Php codeigniter如何更新元组中的单个属性
我想更新表中属性中的一列(元组)。我在控制器中有如下所示的阵列Php codeigniter如何更新元组中的单个属性,php,codeigniter,Php,Codeigniter,我想更新表中属性中的一列(元组)。我在控制器中有如下所示的阵列 $promotion_info = array( 'category' => $this->input->post('category'), 'rank' => $this->input->post('rank'), 'date_of_start' => $date_of_promotion ); 我将其传递给模型,如下所示:
$promotion_info = array(
'category' => $this->input->post('category'),
'rank' => $this->input->post('rank'),
'date_of_start' => $date_of_promotion
);
我将其传递给模型,如下所示:-
$this->insert_model->form_promotion($fno, $promotion_info);
在模型上,我想用促销的日期更新列。然后使用数组中包含的值插入新行(属性)
如何使用数组中的单个值更新该列,如下所示:
在您的情况下,它可能类似于:
在模型中:
$this->db->set($data);// this is case if you need to update all 3 values
//if you need to update only one value from the array than
//$this->db->set('date_of_start', $data['date_of_start']);
$this->db->where('date_of_start', "SOME_EXISTING_DATE_FROM_TABLE");
$this->db->insert('mytable');//
$array = array(
'category' => $name,
'rank' => $title,
'date_of_start' => $status
);
$this->insert_model->form_promotion($fno, $data);
$this->db->set($data);// this is case if you need to update all 3 values
//if you need to update only one value from the array than
//$this->db->set('date_of_start', $data['date_of_start']);
$this->db->where('date_of_start', "SOME_EXISTING_DATE_FROM_TABLE");
$this->db->insert('mytable');//