-1
나는 국가 이름을 확인하고에 MySQL의 데이터베이스에 기록을 미리 존재 확인 중하지만 오류이미 내가 콜백을 사용하는 내 데이터베이스에 존재 codeignitor
$this->form_validation->set_rules('country_name', 'Country Name',
'trim|required|xss_clean|callback_check_exist');
을 쏘지 도다이 내 컨트롤러 기능입니다
function check_exist($country_name)
{
$this->countrymodel->country_exists($country_name);
}
이것은 콜백 함수가 값을 반환하고 MES를 설정해야합니다
function country_exists($key)
{
$this->db->where('country_name',$key);
$this->db->from($this->dbname);
$query = $this->db->get();
if ($query->num_rows()> 0){
return true;
}
else{
return false;
}
}
하지만 지금은 작동하지 않습니다. 동일한 국가를 두 번 이상 추가 할 수 있습니다. –
모델 기능이 예상대로 작동합니까? –
나는 그 일을 생각한다. –