Yes this is a common programing paradigm u need to understand my brother..
to manage the same u need to set a custom callback to the rule..
here is the sample you can look into ..
$crud->set_rules('email', 'Email', 'required|email|callback_email_check');
......and the callback function below
function email_check($email) {
$primary_key = $this->uri->segment(5); // this is what u need to adjust according to yr url pattern..
//mine is deep so i set it 5. u need to do it 4 yr own needs
$rows = $this->cModel->getAllFor('retailer_acct', 'email', $email);
if(!empty($primary_key) && is_numeric($primary_key))
{
if(count($rows)>0) {
if($rows[0]['id'] != $primary_key) {
$this->form_validation->set_message('email_check', 'The email - ' . $email . ' already is assigned to some other user');
return false;
}
}
return true;
} else {
if(count($rows)>0) {
$this->form_validation->set_message('email_check', 'The email - ' . $email . ' already is assigned to some other user');
return false;
} else {
return true;
}
}
}