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

前端 未结 3 1250
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 08:19

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:44

    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);
    }
    

提交回复
热议问题