Welcome Guest, Not a member yet? Register   Sign In
Pagination Next/Previous linking to wrong page
#1

Hi everyone,
I'm trying to implement pagination on some data and it works great.  The only issue is that the Next link goes to the wrong page.
PHP Code:
$data = [
            'title' => 'Character',
            'character' => $character,
            'collection' => $modelCharacterCards
                
->table('character_cards')
                ->select('cards.name, character_cards.qty ')
                ->join('cards''character_cards.cardid = cards.id')
                ->where('character_cards.characterid'$characterid)
                ->paginate(2),
            'pager' => $modelCharacterCards->where('characterid'$characterid)->pager,
        ];

There are 14 rows returned in this query.  The join is 1-1 relationship.

My pager has the right links for pages 1,2,and Last on initial load.  Only the Next link is bad The next link is going to page 4 where I would expect page 2.  When I go to the last page (page 8), Previous link is going to page 5.  Not sure what I am missing herelet me know if you have thoughtsthanks
Reply
#2

You need to customize the links.
https://codeigniter4.github.io/userguide...-the-links
Reply
#3

If it's for Bootstrap I already made the pager links for it search the forms there a whole tutorial on how to do it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB