lukerodham Posted June 7, 2011 Share Posted June 7, 2011 Hey guys for some reason the code below, will insert into the data the information required even if there is the same email address already registered, have i done something wrong? $query = mysql_query("SELECT * FROM users WHERE email=$email"); $count = mysql_num_rows($query); if($count==0){ mysql_query("INSERT INTO users VALUES(NULL,'$firstname','$lastname','$email','$password','$day','$month','$year','$sex')") or die(mysql_error()); echo "Well done. Passwords match"; } else { echo "Please use another email as this one is already registered."; } Quote Link to comment https://forums.phpfreaks.com/topic/238626-msyql_query-help-please/ Share on other sites More sharing options...
dragon_sa Posted June 7, 2011 Share Posted June 7, 2011 try this $query = mysql_query("SELECT * FROM users WHERE email='$email'"); single quotes around $email Quote Link to comment https://forums.phpfreaks.com/topic/238626-msyql_query-help-please/#findComment-1226302 Share on other sites More sharing options...
revraz Posted June 7, 2011 Share Posted June 7, 2011 When something like that doesn't work, try putting your query in a variable, then echo the variable so you can see what is actually being passed. Will help a lot in troubleshooting. Quote Link to comment https://forums.phpfreaks.com/topic/238626-msyql_query-help-please/#findComment-1226310 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.