所以我有这个查询:
$code = substr(md5(mt_rand()) . password_hash(mt_rand(), PASSWORD_DEFAULT), mt_rand(0,5),mt_rand(15,30)) . substr(md5(mt_rand()) . password_hash(mt_rand(), PASSWORD_DEFAULT), mt_rand(3,7),mt_rand(11,20));
$dateRegistered = new DateTime(date("Y-m-d H:i:s", time()));
$codeSql = "UPDATE users SET resetPasswordDate = STR_TO_DATE(?, '%d-%m-%Y'), resetPasswordCode = ? WHERE email=?";
$statement2 = mysqli_stmt_init($connection);
if (!mysqli_stmt_prepare($statement2, $codeSql)){
header("Location: passwordForgot?error=sqlError");
mysqli_stmt_close($statement);
mysqli_close($connection);
exit();
}
else{
mysqli_stmt_bind_param($statement, "sss", $dateRegistered, $code, $email);
mysqli_stmt_execute($statement);
}
由于某种原因,表格未更新。我尝试删除日期以查看是否可行,但没有成功。