且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

致命错误:在布尔值上调用成员函数bind_param()

更新时间:2023-11-11 15:43:28

问题出在:

$query = $this->db->conn->prepare('SELECT value, param FROM ws_settings WHERE name = ?');
$query->bind_param('s', $setting);

prepare() 方法可以返回false,而您应该检查一下.至于为什么返回false,也许表名或列名(在SELECTWHERE子句中)不正确?

The prepare() method can return false and you should check for that. As for why it returns false, perhaps the table name or column names (in SELECT or WHERE clause) are not correct?

此外,考虑使用类似 $this->db->conn->error_list 之类的内容进行检查解析SQL时发生的错误. (我偶尔也会回显实际的SQL语句字符串,并粘贴到phpMyAdmin中进行测试,但是肯定有一些失败的地方.)

Also, consider use of something like $this->db->conn->error_list to examine errors that occurred parsing the SQL. (I'll occasionally echo the actual SQL statement strings and paste into phpMyAdmin to test, too, but there's definitely something failing there.)