You can do with the library form_validation. You pass the name of the field that should be unique and the table name.
The is_unique
will validate this.
is_unique[tbUsuario.campoEmail]
Stay like this
$this->form_validation->set_rules('inputEmail', 'Email', 'required|valid_email|is_unique[tbUsuario.campoEmail]');
The inputEmail
must be replaced by the name of its HTML input, then the table name and the field name in the database. Adjust to your template.
Then execute the validation:
if(!$this->form_validation->run())
... fluxo de erro aqui
No, make a query at the bank specifying(
where
) the value you want to find.– rray