Welcome Guest, Not a member yet? Register   Sign In
catch db errors before returning back to controller
#2

[eluser]sanir[/eluser]
In Controller
Code:
$this->form_validation->set_rules('acc_num','Account Number','trim|required|is_unique[patient_info.account_num]|callback_check_duplicate|xss_clean');

  if ($this->form_validation->run() == FALSE)
  {
   // edit view page
  }
  else
  {
                        // update record
  }

public function check_duplicate($str)
{
  if(!$this->duplicate_mod->check_unique($str)){
   $this->form_validation->set_message('check_duplicate', '<div class="msg failure"><span>record already exists..</span></div>');
   return false;
  }else{
   return true;
  }
}
Try this code.



Messages In This Thread
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:32 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:42 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:56 AM
catch db errors before returning back to controller - by El Forum - 05-29-2012, 11:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB