CodeIgniter Forums
Need - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Need (/showthread.php?tid=8461)



Need - El Forum - 05-19-2008

[eluser]Shahgeb[/eluser]
I need help:
my question is.
i am making a form that client takes signup on site. but client enter the email address, It might be that email address is already exist in db. how i can code this activity,
i am student and working on it last 10 hours but still facing problem plz help me
thanks again

you ppl can your own code just a simple example for email duplication.

Best Regard
Amjad Farooq


Need - El Forum - 05-19-2008

[eluser]Kemik[/eluser]
This is the wrong forum.

You just need to make a callback and use that in the validation of the field.


Need - El Forum - 05-19-2008

[eluser]Michael Wales[/eluser]
This isn't a complete example, just the parts that matter

Code:
$rules['email'] = 'required|valid_email|callback__check_email';
$this->validation->set_rules($rules);

function _check_email($email) {
  $query = $this->db->get_where('users', array('email'=>$email), 1, 0);
  if ($query->num_rows() != 0) {
    $this->validation->set_message('_check_email', 'That email address has already been registered.');
    return FALSE;
  }
  return TRUE;
}

Should be enough to get you on your way.


Need - El Forum - 05-20-2008

[eluser]Shahgeb[/eluser]
boundle of thanks i have made it possible with your guidence. thanks again