if ($stmt = $connection->prepare('INSERT INTO users (name, id, password, email, city, avatar, about, activation_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')) {
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$uniqid = uniqid();
$stmt->bind_param('ssssssss', $_POST['name'], $_POST['id'], $password, $email, $_POST['city'], $_POST['avatar'], $_POST['about'], $uniqid);
$stmt->execute();
$stmt->store_result();
echo 'Account's created';
} else {
echo 'Error';
}
这部分代码不会在myqsl db中创建用户。但是如果我此代码:
$stmt->bind_param('ssssssss', $_POST['name'], $_POST['id'], $password, $email, $_POST['city'], $_POST['avatar'], $_POST['about'], $uniqid);
替换为:
$stmt->bind_param('ssssssss', $_POST['name'], $_POST['id'], $email, $password, $_POST['city'], $_POST['avatar'], $_POST['about'], $uniqid);
它创建了用户,但电子邮件表中有密码,而密码-电子邮件中。我该如何解决???
if($ stmt = $ connection-> prepare('INSERT INTO users(name,id,password,email,city,avatar,about,activation_code)VALUES(?,?,?,?,?,?,?,?, ?)')){$ password = password_hash($ _ POST ['...
问题在于您的prepare插入语句和绑定语句之间存在冲突陈述一