![]() |
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=81603) Pages:
1
2
|
Pagination - Z4K7 - 03-25-2022 Hello I hope you can help me I try to make a pagination with CI4 but I have not succeeded At the time of consulting the DB, only specific profiles are requested, which is number 3 Model PHP Code: public function getAll( $start = 0, $limit = 0,$role_id = '3') Controller When I do pager to get it out it doesn't work it throws me an error. ErrorException Trying to get property 'page' of non-object PHP Code: public function index() RE: Pagination - ignitedcms - 03-25-2022 At first glance I would have thought it would be 'pager' instead of 'page' but I haven't looked into it closely. RE: Pagination - luckmoshy - 03-25-2022 PHP Code: public function index() RE: Pagination - Z4K7 - 03-26-2022 (03-25-2022, 09:58 PM)luckmoshy Wrote:It doesn't work, it lists all the users and I only need to list those with role #3 ![]() RE: Pagination - InsiteFX - 03-27-2022 I suggest that you read the CodeIgniter User Guide on Library - Pagination. Your doing it all wrong. RE: Pagination - Z4K7 - 03-27-2022 (03-27-2022, 12:30 AM)InsiteFX Wrote: I suggest that you read the CodeIgniter User Guide on Library - Pagination. But in this case, it only loads the complete table with all the users, but not the users that I have in a certain group. If I make a pagination to the model, it loads me without the function that I created. RE: Pagination - InsiteFX - 03-28-2022 In my blog I get category blogs and it returns correct, I look at my code and see how I did it. RE: Pagination - ignitedcms - 03-28-2022 Just to add to this, I would also recommend separating the flow control and focusing on just the database query, to see if it returns what you expect, before passing it through the pagination. RE: Pagination - Z4K7 - 03-28-2022 (03-28-2022, 12:23 AM)InsiteFX Wrote: In my blog I get category blogs and it returns correct, I look at my code and see how I did it. (03-28-2022, 06:21 AM)ignitedcms Wrote: Just to add to this, I would also recommend separating the flow control and focusing on just the database query, to see if it returns what you expect, before passing it through the pagination.On the part of the DB query it works without any problem, it is only the paginate section RE: Pagination - ignitedcms - 03-28-2022 In that case, try and work backwards with a simplified example by following the documentation. https://codeigniter.com/user_guide/libraries/pagination.html |