You can do with the form_validation library. You pass the field name that should be unique and the table name.
is_unique
will validate this.
is_unique[tbUsuario.campoEmail]
Stay the same
$this->form_validation->set_rules('inputEmail', 'Email', 'required|valid_email|is_unique[tbUsuario.campoEmail]');
The inputEmail
should be replaced with the name of your input in the HTML, then the name of the table and the name of the field in the database. Fit according to your model.
Then perform the validation:
if(!$this->form_validation->run())
... fluxo de erro aqui