Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
CodeIgniter

Searching and Filtering in CodeIgniter

Add keyword search and filters using query parameters and Query Builder where clauses.

Searching and Filtering in CodeIgniter — a practical guide to CodeIgniter search filter with clear examples you can reuse in real projects.

CodeIgniter Tutorial Series (40/74). Prefer one article? Read the complete CodeIgniter tutorial.

Short description

Read `q` from the request and apply `like` / `where` conditions before pagination.

Search + paginate

$q = $this->request->getGet('q');
$model = new AppModelsPostModel();
if ($q) {
    $model->like('title', $q);
}
$data['posts'] = $model->paginate(10);
$data['pager'] = $model->pager;
$data['q'] = $q;

Leave a reply

Your email address will not be published. Required fields are marked *