我有一棵if树在这一点上失败了。我不确定为什么php代码没有写入MySQL数据库。任何帮助是极大的赞赏。代码在第1行之后的某个时间失败。
if ($numrows == 0) {
$password = md5(md5("qkIa4".$getpass."qwenm"));
$date = date("F d, Y");
$code = md5("fekwe".$password);
//insert user into db
mysql_query("INSERT INTO users VALUES ('', '$getuser', '$password', '$getemail', '0', '$code', '$date', '$fn', '0')");
//check if entry was made into db
$query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
$numrows = mysql_num_rows($query);
if ($numrows == 1) {
//email the user code
}
else
$errormsg = "An error has occured. Your account was not created.";
echo mysql_error();
echo $getuser;
echo "<br />";
echo $password;
echo "<br />";
echo $getemail;
echo "<br />";
echo $code;
echo "<br />";
echo $fn;
代码只回显mysql_connect();已弃用。所有变量都正确回显。
提前致谢!