Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!------begin controller--->
- $this->form_validation->set_rules('sli_status', 'Status', 'trim|required|callback_isExist');
- $this->form_validation->set_error_delimiters('<font color="red">', '</font>');
- if ($this->form_validation->run() == FALSE)
- {
- }
- else {
- //do insert database
- }
- public function isExist() {
- $is_exist = $this->model_slide->isExist();
- if ($is_exist) {
- $this->form_validation->set_message(
- 'isEmailExist', 'Status dengan classa ctive sudah ada'
- );
- return false;
- } else {
- return true;
- }
- }
- <!----------------------model ------------------------->
- function isExist() {
- $this->db->where('sli_status','active');
- $this->db->select("*");
- $this->db->from("slide");
- $query=$this->db->get();
- if ($query->num_rows() > 0) {
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement