Check when edit if the field is not duplicate Entry

if($this->input->post(‘user_name’) != $original_value) {
$is_unique = ‘|is_unique[users.user_name]’
} else {
$is_unique = ”
}

$this->form_validation->set_rules(‘user_name’, ‘User Name’, ‘required|trim|xss_clean’.$is_unique);

Please follow and like us:
0