本文介绍了在非对象上调用成员函数execute()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我包含该错误的脚本是这样的:
My script containing that error is this:
$stmt = $this->db->prepare('SELECT libelle,activite,adresse,tel,lat,lng FROM etablissements where type IN ('.$in_list.')');
$stmt->execute();
$stmt->bind_result($libelle,$activite,$adresse,$tel,$lat,$lng);
服务器(非本地主机)上运行的php版本是5.2.17
The php version running on the server (not localhost) is 5.2.17
推荐答案
$stmt
应该是使用方法execute()
的对象.
似乎$this->db->prepare()
没有返回好的结果.
$stmt
is supposed to be an object with the method execute()
.
Seems like $this->db->prepare()
is not returning the good result.
如果$this->db
是 mysqli()
对象,则应绑定参数,例如:
if ($stmt = $this->db->prepare('SELECT libelle,activite,adresse,tel,lat,lng FROM etablissements where type IN (?)')) {
$stmt->bind_param("s", $in_list);
$stmt->execute();
// ...
}
这篇关于在非对象上调用成员函数execute()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!