PDA

View Full Version : check if the email already exists


kasiarakos
09-13-2010, 08:28 AM
hello i have this code to check if the given email already exist in me database



//check if email already exist
$email=$_POST['email'];
if(mysql_num_rows(mysql_query("SELECT email FROM users WHERE email = '$email'"))){
$msg=$msg."Userid already exists. Please try another one<BR>";
$status= "NOTOK";}


but when I put in the form an emai that already exists I have this massage:


Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\kasi_web\game\checkregister.php on line 75


what's wrong?

davidj
09-13-2010, 06:14 PM
if(mysql_num_rows(mysql_query("SELECT email FROM users WHERE email = '$email'"))>0)