$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-67b084e8f2ce6292970359/] Contact_form.php - view [crayon-67b084e8f2cf6432004643/] Contact_model [crayon-67b084e8f2cfd642242682/] Captcha Helper [crayon-67b084e8f2d04063429744/] Notifications_model [crayon-67b084e8f2d0c514418179/] Database…
[crayon-67b084e8f30fe202929586/] [crayon-67b084e8f3104549504671/]
[crayon-67b084e8f3268486064524/] The first parameter specifies the type of string, the second parameter specifies the length.…
Create Controller [crayon-67b084e8f3398801280249/] 2. Create View File [crayon-67b084e8f339f856431994/]
All of the native error messages are located in the following language file: system/language/english/form_validation_lang.php To set…
Database:- [crayon-67b084e8f35d9893924112/] application/model/Pagination_model.php [crayon-67b084e8f35df044928914/] application/controllers/Pagination.php [crayon-67b084e8f35e2002078169/] application/views/pagination.php [crayon-67b084e8f35e7502606058/]