在非对象上调用成员函数execute()

Mal*_*loc 4 php mysql

包含该错误的脚本是这样的:

$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);
Run Code Online (Sandbox Code Playgroud)

在服务器(而不是localhost)上运行的php版本是5.2.17

Pie*_*NAY 5

$stmt应该是该方法的对象execute().
好像$this->db->prepare()没有回报好结果.

如果$this->dbmysqli()对象,您应该绑定这样的参数:

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();
  // ...
}
Run Code Online (Sandbox Code Playgroud)