致命错误:在非对象上调用成员函数fetchAll()[重复]

This question already has an answer here:

Fatal error: Call to a member function fetchAll() on a non-object in **************/includes/Dbo.class.inc on line 41

Line 41:

public function selectCondition($database, $table, $condition, $condition_value){
  return $database->debug()->select($table, "*", array($condition => $condition_value))->fetchAll(PDO::FETCH_ASSOC);
}

After calling this function to get an result array it displays the error mentioned above. Any ideas?

</div>

According to documentation select() returns array so you can't call any other method on this result.

So your code should look like this:

return $database->debug()->select($table, "*", array($condition => $condition_value));

edit:
It is not working also because of debug mode. Correct code should look like this:

 return $database->select($table, "*", array($condition => $condition_value));