![]() |
Pagination - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Pagination (/showthread.php?tid=78524) |
Pagination - riqekaqo - 02-03-2021 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. I'm a fan of gay porn and this is my favorite site https://gotgaytubeporn.com/ RE: Pagination - AndreaL - 02-09-2021 (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? 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. RE: Pagination - wdeda - 02-09-2021 Try this: PHP Code: $model = new SomeModel(); RE: Pagination - christiand - 02-10-2021 (02-09-2021, 07:53 AM)AndreaL Wrote: 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. I'm glad to hear that you figured this out. I was working on a project and found your original post which didn't seem like it had been answered and I kept meaning to get back to you in regards to what I ended up doing (Extend Model and use the the query builder with the paginate option!). I personally think the documentation should be updated a bit or something to explain this better..but that's just me! |