Welcome Guest, Not a member yet? Register   Sign In
Pagination
#2

(02-03-2021, 02:49 AM)riqekaqo Wrote: From past few days I have started working in CI4, I would like to know how pagination works with below query?

1. $query = $this->db->query("select * from users");
$result =  $query->getResultArray();

Using model is working as expected find below query
2. $data = [
            'users' => $this->users->where('active', '1')->paginate(4),
            'pager' => $this->users->pager
        ];

But facing issue with above 1st query result set. Could you please help me out to resolve this issue

Thank you in advance.

Hi, I think you are having a problem very similar to mine. I also had a query built with the "query" function and struggled quite a lot to get it to work. Then I found a way to rewrite the query extending the Model and everything is just fine. I know this doed not solve the problem but if you can share the query you have to write (the one you wrote can easily be done using the Model) I can try to help you out since I also had to waste a lot of time using the query function along with pagination.
Reply


Messages In This Thread
Pagination - by riqekaqo - 02-03-2021, 02:49 AM
RE: Pagination - by AndreaL - 02-09-2021, 07:53 AM
RE: Pagination - by christiand - 02-10-2021, 08:32 AM
RE: Pagination - by wdeda - 02-09-2021, 01:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB