Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 Pagination With Join and Where sql
#15

(06-24-2022, 05:33 AM)kenjis Wrote:
(06-24-2022, 04:45 AM)demyr Wrote: For example, if it was set for 7,15 It starts from 16 + 7 items and same items for each pagination 1-2-3-4.. No different result.

If limit is 7:
Page 1: 1 to 7
Page 2: 8 to 14
Page 3: 15 to 21
Page 4: 22 to 28

You need two things for pagination.
1. pagination links
2. data to display

1. needs total count, per page, current page number.
2. needs data set to display.

I understand. My problem is with the combination of 1 and 2 as I wrote you before. Your codes work when I do it in controller but then I cannot use my joins for sql.
This works as I told you but how can I use my joins? :

PHP Code:
$pager service('pager');
$count $model->where('offer_status''pending')->countAllResults();

$page    = (int) ($this->request->getGet('page') ?? 1);
$perPage 5;
$total  $count;

$data['offers_pending'] = $model->where('offer_status''pending')->paginate($perPage);

$pager_links $pager->makeLinks($page$perPage$total);
$data['pager_links'] = $pager_links
Reply


Messages In This Thread
RE: Codeigniter 4 Pagination With Join and Where sql - by demyr - 06-24-2022, 06:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB