这个问题在这里已经有了答案:
Fatal error: Call to a member function bind_param() on boolean [duplicate]
(12 个回答)
4年前关闭。
我有这个代码:
echo "debug 12.1";
$stmmt21 = $conn->prepare("INSERT INTO Together (OneT, TwoT) VALUES (?, ?)");
$UserOne = "netsgets";
$UserTwo = "netsgets2";
$stmmt21->bind_param('ss', $UserOne, $UserTwo);
$UserOne = "netsgets";
$UserTwo = "netsgets2";
$stmmt21->execute();
$stmmt21->store_result();
当我运行它时,我收到此错误:
Call to a member function bind_param() on boolean
最佳答案
这是因为您的声明$conn->prepare(...
导致某种错误,肯定会分配false
至$stmmt21
.所以当你调用bind_param(...
在 $stmmt21
,解析器会在 boolean
上提示它不允许.
解决方案:请检查为什么是 $conn->prepare()
给你错误。是由于您的连接字符串,还是 INSERT
您指定的查询。
关于php - 在插入数据 (PHP) 中调用 bool 值的成员函数 bind_param(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46679755/