INSERT - Number of bind variables doesn#39;t match number of fields in prepared statement(INSERT - 绑定变量的数量与准备好的语句中的字段数量不匹配)
问题描述
我得到:
警告: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 - 绑定变量的数量与准备好的语句中的字段数量不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:INSERT - 绑定变量的数量与准备好的语句中的字段


- 没有作曲家的 PSR4 自动加载 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Laravel 仓库 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01