Welcome Guest, Not a member yet? Register   Sign In
Check if value exists in database?
#1

[eluser]invision[/eluser]
Hi,

I have a very simple model for adding users to my database.

Code:
function userExists() {    
        $email = $this->input->post('email');        
        $this->db->where("email",$email);
        $Q = $this->db->get('users');
        if ($Q->num_rows() > 0){
            return TRUE;
        }
    }

I run this in my Controller with:

Code:
if ($this->MUsers->userExists() == TRUE)
{
    die('bla - exists');
}

Now I wonder, how do I send the message back to my form page and still keep the form elements in place?

I basically just want to add a warning message above my form explaining the email is taken.



Many thanks for any help.


Messages In This Thread
Check if value exists in database? - by El Forum - 10-02-2010, 03:07 AM
Check if value exists in database? - by El Forum - 10-02-2010, 06:28 AM
Check if value exists in database? - by El Forum - 10-02-2010, 06:43 AM
Check if value exists in database? - by El Forum - 10-02-2010, 07:57 AM
Check if value exists in database? - by El Forum - 10-02-2010, 08:01 AM
Check if value exists in database? - by El Forum - 10-02-2010, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB