$id = 2; $this->load->library('form_validation'); if ($this->input->server('REQUEST_METHOD') == 'POST') { $this->form_validation->set_rules('user_email', 'Email', 'min_length[5]|valid_email|required|xss_clean|callback_is_unique_email['.$id.']',array('required'=> 'You have not provided %s.','is_unique'=> 'This %s already exists.')); $this->form_validation->set_message('is_unique_email', 'Email Address already in use'); $this->form_validation->set_message('valid_email', 'Please enter valid email address'); if ($this->form_validation->run() == FALSE) { echo 'error'; } else { echo 'success'; } }
function is_unique_email($email, $id) { $this->db->where('user_email', $email); $this->db->where('id !=', $id); $query = $this->db->get('users'); if($query->num_rows() > 0) { return false; } else { return true; } }
Contact Controller [crayon-68b74938a7cc5338057126/] Contact_form.php - view [crayon-68b74938a7cd7074075385/] Contact_model [crayon-68b74938a7cdf766926872/] Captcha Helper [crayon-68b74938a7ce9485967862/] Notifications_model [crayon-68b74938a7cf5251467239/] Database…
[crayon-68b74938a80f0562618678/] [crayon-68b74938a80f8544108608/]
[crayon-68b74938a835b473159803/] The first parameter specifies the type of string, the second parameter specifies the length.…
Create Controller [crayon-68b74938a8811572584534/] 2. Create View File [crayon-68b74938a8819464042500/]
All of the native error messages are located in the following language file: system/language/english/form_validation_lang.php To set…
Database:- [crayon-68b74938a9bfb794471441/] application/model/Pagination_model.php [crayon-68b74938a9c05364632474/] application/controllers/Pagination.php [crayon-68b74938a9c08977195802/] application/views/pagination.php [crayon-68b74938a9c0d817768432/]