php - check value exists in database using general function Codeigniter -
i studying codeigniter developing website locally. uncertainty is, added fields in table unique
.
when seek add together duplicate values, shows internal server error
i overcome add together function check if duplicate entry. need add together function on each table insertion.
my question is, is there way write function @ my_model.php
check table
, unique field value
, phone call in my_controller.php
passing table name
, unique field value
you can utilize codeigniter's default form validation check if new value beingness added unique field exists in db or not.
refer this:
is_unique | returns false | if form element not unique table , field name in parameter. is_unique[table.field]
this->form_validation->set_rules('email', 'email', 'required|is_unique[users.email]');
php codeigniter model controller
No comments:
Post a Comment