PHP无法找到我的代码有什么问题(注册)

时间:2016-05-24 19:56:43

标签: php mysql

我试图用准备好的陈述创建一个注册表单,密码散列,我不断得到错误消息&#34;我在if(isset($_POST['save'])){ $username = $_POST["username"]; $password = password_hash($_POST["password"], PASSWORD_BCRYPT); $email = $_POST["email"]; $stmt = $mysqli->prepare("INSERT INTO users (username, password, email) VALUES (?, ?, ?)"); $stmt->bind_param("sss",$username, $password, $email); $stmt->execute(); $nrows = $stmt->affected_rows; if($nrows == 1){ header("Location: http://localhost/test2/Login.php");} else{ echo "<script type='text/javascript'>alert('Something went wrong!')</script>";} } 声明中提供的。

P0 P1 P2 
 P0P1 P2
 P0P1 P1P2
 P0P1 P0P2
 P0P2 P1
 P0P2 P0P1
 P0 P1P2

1 个答案:

答案 0 :(得分:1)

db中的密码字段是CHAR(40)。 但声明

password_hash($_POST["password"], PASSWORD_BCRYPT);

给60个字符.. 这一定是个问题。