dimanche 28 décembre 2014

Checking if a username or email exists in the DB already


Vote count:

0




I want to check if the username of email already exists in the DB when a user signs up to my website. I have the following code which isn't working and i'm not sure why. If anyone could point me in the right direction to validate against already existing info in the DB I would greatly appreciate it! Thanks



$query = mysql_query("SELECT * FROM users WHERE username = '". $username ."' OR email = '". $email ."'");



if (mysql_num_rows($query) > 0){

die ('Username or email already in use.');

}


asked 23 secs ago







Checking if a username or email exists in the DB already

Aucun commentaire:

Enregistrer un commentaire