Using the following code below as part of a validation script, I am trying to check that the email that is represented by $_POST['email'] has not already been entered in the table.
require ('../mysql_connect.php'); // Connect to the db.
$temp = $_post['email']; //value from form
$searchquery = "SELECT * from members where email = '".$temp"'";
$searchresult = @mysql_query($searchquery); //run the query
if ($searchresult) {
$num_rows = mysql_num_rows($searchresult);
if(num_rows == 0) { // email does not exist in table
$e = $_POST['email'];
}
else { // email address has been found in table
$eMess = '<p class = "bodytext">* Email address been used already!</p>' . $num_rows;
$e = FALSE;
}
}
However the code above is not finding the email address eben though I know it exists in the table.
Any help welcome
J