public function hasNextPage() { return $this->page < $this->pages; }
function getSearchResultLoop($s, $max_pp = null) { if (!isset($this->p)) { $s = $this->conn->real_escape_string(urldecode($s)); $loop_first_search_query = "SELECT * FROM c_posts WHERE (post_content LIKE '%{$s}%' OR post_excerpt LIKE '%{$s}%' OR post_title LIKE '%{$s}%' OR post_description LIKE '%{$s}%' OR link_title LIKE '%{$s}%' OR tags LIKE '%{$s}%') AND post_status <> 'Initialized'"; $this->res = $this->conn->query($loop_first_search_query); dbQueryCheck($this->res, $this->conn); $this->search_res_count = $this->res->num_rows; // set search result count, should be accessed only after function call $this->p = 'set'; } if (!isset($loop_search_query)) { $s = $this->conn->real_escape_string(urldecode($s)); $pagination = new Pagination($max_pp, $this->search_res_count); $loop_search_query = "SELECT * FROM c_posts WHERE (post_content LIKE '%{$s}%' OR post_excerpt LIKE '%{$s}%' OR post_title LIKE '%{$s}%' OR post_description LIKE '%{$s}%' OR link_title LIKE '%{$s}%' OR tags LIKE '%{$s}%') AND post_status <> 'Initialized' "; $loop_search_query .= "LIMIT {$pagination->per_page} "; $loop_search_query .= "OFFSET {$pagination->offset()}"; } if (!isset($this->j)) { $this->res = $this->conn->query($loop_search_query); dbQueryCheck($this->res, $this->conn); $this->j = 'set'; } $this->total_pages = $pagination->totalPages(); $this->hasPreviousPage = $pagination->hasPreviousPage(); $this->hasNextPage = $pagination->hasNextPage(); $this->previousPage = $pagination->previousPage(); $this->nextPage = $pagination->nextPage(); return $this->res->fetch_assoc(); }