이것은 테이블 이름이 borrow_user
이고 NOW()
인 데이터베이스에 데이터를 삽입하기위한 배열로, borrow_user
테이블의 avt_date
필드 이름에 사용됩니다.codeigniter에서 모델 인수에 대해 NOW() 함수를 배열에 전달할 수 있습니까?
코드 서명자에서 NOW()
함수를 배열의 모델 인수로 전달할 수 있습니까?
$data = array(
'user_name'=>$name,user_name is a field name in table
'user_father_name'=>$this->input->post('father_name'),//user_father is a field name in table
'user_dob'=>$this->input->post('DOB'), //user_dob is a field name in table
'user_email'=>$this->input->post('email'), // user_email is a field name in table
'user_pass'=>md5($pass), //user_pass is a field name in table
'user_address'=>$this->input->post('address'),
'phn'=>$this->input->post('phn'),
'user_type'=>2,
'avt_date'=>NOW()); //now() function is not working given an error .
$this->load->model('login_user');
$regis_id=$this->login_user->regis_b($data);
//model class code
public function regis_b($data)
{
$arr=array('user_email'=>$data['user_email']);
$this->db->insert('borrow_user', $data);
$sel_id=$this->db->select('id')
->from('borrow_user')
->where($arr)
->get();
if($sel_id->num_rows())
{
return $sel_id->row()->id;
}else{
return FALSE;
}
}
무엇이 오류입니까? –