Why do I get this function call error on an non-object when I am calling a function on an object?

前端 未结 3 824
野的像风
野的像风 2021-01-20 08:04

Error:

Fatal error: Call to a member function bind_param() on a non-object in /var/www/web55/web/pdftest/events.php on line 76

Co

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-20 08:36

    AND c.category_id = ? - there is no table alias c in your query.

    Besides that try

    $stmt = $this->link->prepare($sql);
    if (!$stmt) {
      throw new ErrorException($this->link->error, $this->link->errno);
    }
    
    if (!$stmt->bind_param('i', $this->locationID) || !$stmt->execute()) {
      throw new ErrorException($stmt->error, $stmt->errno);
    }
    

提交回复
热议问题