I'm trying to paginate the search results returned by the query. I have the following URL:
$start = $this->uri->segment(3);
That's because of the
? character in the URI. CodeIgniter URI parser (and any other standard URI parser) does not recognize what you have in mind. After the
? character, it's all query string, not URI segments. See the output of PHP's
parse_url('blog/search?query=post/5') [ "path" => "blog/search", "query" => "query=post/5", ]
See? The first segment is
blog, the second is
search and the rest is the querystring.
You need to change your URI design in an standard way. For example:
So that the call to
$this->uri->segment(3) will return what you have in mind.
Speaking of CodeIgniter pagination library, see
page_query_string configs in the documentation.