php - How to prevent duplicate email addresses from being registeres? -
i have been making login/register system , 1 problem have run not allowing duplicate email addresses being registered. want work database wont accept data duplicate email , user alerted too. sort of new php unsure of how this. thanks. my php if (empty($_post['email'])) { $error[] = 'please enter email '; } else { if (preg_match("/^([a-za-z0-9])+([a-za-z0-9\._-])*@([a-za-z0-9_-])+([a-za-z0-9\._- ]+)+$/", $_post['email'])) { //regular expression email validation $email = $_post['email']; } else { $error[] = 'your email address invalid '; } } if (empty($_post['password'])) { $error[] = 'please enter password '; } else { $password = $_post['password']; } if (empty($error)) //send database if there's no error ' { // if everything's ok... // make sure email address available: $query_verify_email = "select * members email ='