我有以下代码,因此在将记录写入数据库之前,它会检查是否存在已存在的用户名.....
$duplicate=mysql_query("SELECT username FROM user WHERE username='" . $username . "'");
if ($duplicate <> $username) {
$insertquery = mysql_query("insert into user (username, password, lastlogin, address1, address2, address3, email) values ('$userid', '$password', now (),'$address1','$address2','$address3','$email')");
//$msg = "Successfully Registered!";
$msg = mysql_fetch_assoc($username);
} else {
$pass_err = "This Username Is Already In Use!";
$msg = "This Username Is Already In Use!";
$userid="";
$err_flag="False";
$dupe="";
$numrecords=0;
}
}
我错过了什么?它总是说它已经存在,当我知道它不存在时......