public function count($table) { $con = Database::getConnection(); $sql = "SELECT COUNT(*) FROM {$table} WHERE {$this->condition} ORDER BY {$this->orderBy}"; $req = $con->prepare($sql); $req->execute(); if ($req->errorInfo()[2] != null) { Database::errorLog($req); } else { Database::accessLog($sql); } return $req->fetch()[0]; }