PRodgers4284 Posted February 11, 2008 Share Posted February 11, 2008 I need some help with an edit form i have on my uni project, the form allows users to edit their user account once they are logged into the system. My problem is that is the function i am calling to check the email when the users is editing the account checks all the records in the database. The problem with the code is that i need it to look up the database to check that the email does not already exist but not look up the email that the user already has if that makes sense. Im using $_SESSION["username"] which gets the user account details of the user that is logged in and populates the edit form with the information. Can anyone please help me with this, im really stuck with it. my code is function emailTaken($email){ global $conn; if(!get_magic_quotes_gpc()){ $email = addslashes($email); } $q = "select username from users where email = '$email'"; $result = mysql_query($q,$conn); return (mysql_numrows($result) > 0); } The function is called: if(emailTaken($email,$conn)) { $error_stat = 1; $email_message = '*Email is taken please choose another one*'; } Phil Quote Link to comment Share on other sites More sharing options...
PRodgers4284 Posted February 11, 2008 Author Share Posted February 11, 2008 Got it working Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.