-1
使用codeigniter模型插入和檢索包含數組的數據。在插入檢索數據中插入檢索數據codeigniter模型
型號:
function abc {
$tomorrow_date=$this->input->post('datee');
$id=$this->input->post('id');
$this -> db -> select('name,phone,address,age');
$this -> db -> from('user_reg');
$this -> db -> where('patient_id',$id);
$this -> db -> where('date',$tomorrow_date);
$query = $this -> db -> get();
if ($query->num_rows() > 0)
{
$row = $query->row();
}
我想插入如:
$data = array(
'date'=>$tomorrow_date,
'name'=>$name,
'phone'=>$phone,
'address'=>$address,
'age'=>$age,
'patient_id'=>id,
);
$this->db->insert('user_info',$data);
}
我怎樣才能插入數據?