INSERT - 绑定变量的数量与准备好的语句中的字段数量不匹配
INSERT - Number of bind variables doesn't match number of fields in prepared statement
我得到:
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't
match number of fields in prepared statement in
E:\XAMPP\htdocs\account\lib\register.php on line 73
当我使用这段代码时:
if($stmt = $conn -> prepare("INSERT INTO login(user, pass) VALUES(?, ?)")) {
/* Bind parameters s - string, b - blob, i - int, etc */
$stmt -> bind_param("ss", $user, $pw);
/* Execute it */
$stmt -> execute();
/* Bind results */
$stmt -> bind_result($user, $pw);
/* Close statement */
$stmt -> close();
$userId = $conn->insert_id;
}
我不明白,为什么每次都这样,我的代码片段有什么问题吗?
您正在尝试 bind_result
一个未返回任何结果的语句。
删除此行。
$stmt -> bind_result($user, $pw);
我得到:
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in E:\XAMPP\htdocs\account\lib\register.php on line 73
当我使用这段代码时:
if($stmt = $conn -> prepare("INSERT INTO login(user, pass) VALUES(?, ?)")) {
/* Bind parameters s - string, b - blob, i - int, etc */
$stmt -> bind_param("ss", $user, $pw);
/* Execute it */
$stmt -> execute();
/* Bind results */
$stmt -> bind_result($user, $pw);
/* Close statement */
$stmt -> close();
$userId = $conn->insert_id;
}
我不明白,为什么每次都这样,我的代码片段有什么问题吗?
您正在尝试 bind_result
一个未返回任何结果的语句。
删除此行。
$stmt -> bind_result($user, $pw);