CodeIgniter Forums
Need Help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Need Help (/showthread.php?tid=80383)



Need Help - Milina - 10-26-2021

Hello all!! I hope someone can help me really quick here!

So this is my case,

I've got a table of items, and the items have 4 different types. And I've got a column named types, the value that differs in that column are from 1 to 4.

So with this part:

$model = new ButikkModel();

$data['currentPage'] = $this->request->getVar('ovn_page') ? $this->request->getVar('ovn_page') : 1;

$data = [

'ovner' => $model->where('type', '1')

->orderBy('created_at', 'DESC')

->findAll(),

'pager' => $model->pager

];



it grabs the items just fine, that has type "1". But I can't pagination this... How would I go ahead and do this? Normally you can just add ->pagination after $model, but can't do that because it's an array when using findAll().



Anyone?


RE: Need Help - includebeer - 10-26-2021

Call paginate() instead of findAll(). You can see an example on how to do pagination in this tutorial: https://includebeer.com/en/blog/how-to-build-a-basic-web-application-with-codeigniter-4-part-4

@Milina I move the thread in General Help. This had nothing to do with installation problems.


RE: Need Help - BettyMartinez - 10-29-2021

I hope you received some help with it.
Did you?