matttherat Posted June 15, 2010 Share Posted June 15, 2010 Hi. am new to php. followed a tutorial to do an email verification but it isnt set to check the db for exisiting emails. want it so only one email can be registered per person. can anyone help? If u want to see my code see attached file [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/204835-check-email-doesnt-exist-already/ Share on other sites More sharing options...
trq Posted June 15, 2010 Share Posted June 15, 2010 All you need to do is execute a SELECT statement that looks for the given email within your database, if not found proceed, otherwise, display some message saying the email is already in use. Quote Link to comment https://forums.phpfreaks.com/topic/204835-check-email-doesnt-exist-already/#findComment-1072327 Share on other sites More sharing options...
Bottyz Posted June 15, 2010 Share Posted June 15, 2010 Hi. am new to php. followed a tutorial to do an email verification but it isnt set to check the db for exisiting emails. want it so only one email can be registered per person. can anyone help? If u want to see my code see attached file Something like the following should work for you. You may want to tweak it. $check = mysql_query("SELECT email FROM temp_members_db WHERE email = '$email'") $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { header("refresh: 5; signup_ac.php"); die('Sorry, the email <b>'. $email .'</b> is already in use.'); } Quote Link to comment https://forums.phpfreaks.com/topic/204835-check-email-doesnt-exist-already/#findComment-1072332 Share on other sites More sharing options...
matttherat Posted June 15, 2010 Author Share Posted June 15, 2010 Hi. am new to php. followed a tutorial to do an email verification but it isnt set to check the db for exisiting emails. want it so only one email can be registered per person. can anyone help? If u want to see my code see attached file Something like the following should work for you. You may want to tweak it. $check = mysql_query("SELECT email FROM temp_members_db WHERE email = '$email'") $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { header("refresh: 5; signup_ac.php"); die('Sorry, the email <b>'. $email .'</b> is already in use.'); } Hi. thanks. that looks pretty good but not really working. It just seems to have a blank page.it is working as in it doesnt send the info to the database. Just want it so it also redirects to a new page say bla.html. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/204835-check-email-doesnt-exist-already/#findComment-1072482 Share on other sites More sharing options...
TOA Posted June 15, 2010 Share Posted June 15, 2010 it doesnt send the info to the database. Did you change the field and table names to match yours? Just want it so it also redirects to a new page say bla.html. any ideas? he does that, just change signup_ac.php to your desired redirect location like: header(refresh:5; url='blah.html'); Quote Link to comment https://forums.phpfreaks.com/topic/204835-check-email-doesnt-exist-already/#findComment-1072533 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.