我有检查电子邮件是否已被使用的功能 这是我的代码,我希望你们可以帮助我
if($_POST['submit']) {
//basic email validation
if ( !filter_var($uemail,FILTER_VALIDATE_EMAIL) ) {
$error = true;
$emailError = "Please enter valid email address.";
} else {
// check email exist or not
$query = "SELECT email FROM userz WHERE email='$uemail'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if($count != 0){
$error = true;
$emailError = "Provided Email is already in use.";
}
}
$thequery = mysql_query($sql);
}
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
答案 0 :(得分:0)
只是为了清理一下,我会先将if语句改为if($ count> 0)。原因是有时可以返回值NULL并且NULL!= 0因此它将通过。简单的改变,但可能会有所帮助