我得到:
警告:mysqli_stmt::bind_result():绑定变量的数量没有匹配准备好的语句中的字段数E:XAMPPhtdocsaccountlib egister.php 第 73 行
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in E:XAMPPhtdocsaccountlib egister.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;
}
我不明白,为什么每次都发生这种情况,我的代码片段有什么问题?
I can't understand, why this happens every time, what is wrong in my code snippet?
您正在尝试对未返回任何结果的语句进行bind_result
.
You are attempting to bind_result
on a statement that is not returning any results.
删除此行.<代码>$stmt ->bind_result($user, $pw);
这篇关于INSERT - 绑定变量的数量与准备好的语句中的字段数量不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!