Welcome Guest, Not a member yet? Register   Sign In
Extending callback function?
#2

[eluser]tonanbarbarian[/eluser]
since the code you have there must be included in the controller, then have your main method in the controller store the id in the object before the validation is done

i.e.
Code:
...
$this->id = $id;
$this->validation->run();
...

Then in your callback just lookup the id
Code:
function edit_email_check($str)
  {
      //  PREVENT EMAIL DUPLICATES
      $query = $this->db->query(“SELECT * FROM users where email = ‘$str’ AND id != ‘{$this->id}’”);
      $cnt = $query->num_rows();
      if ($cnt)
      {
        //$this->form_validation->set_message(‘edit_email_check’, ‘The %s ’ . $str . ’ is already in use’);
        return “$str is already in use”;
      }
      return FALSE;
  }


Messages In This Thread
Extending callback function? - by El Forum - 12-22-2010, 10:01 PM
Extending callback function? - by El Forum - 12-22-2010, 10:20 PM
Extending callback function? - by El Forum - 12-22-2010, 10:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB