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

Hello I have a problem with paging the results of a query, I have read the documentation for codeigniter4 pagination,

But they show how to paginate the results of all the data in a table. I don't know how to paginate the results of a query. 
Can you help me?

Controller:

Quote:    public function index()
    {  
$TecnicsModel = new TecnicsModel();    
$published=1;
$data['results']= $TecnicsModel->result_published($published);
return view('views/view.php');
    }



Model:
 
Quote:   public function result_published($published)
    {
    $query = "SELECT  * FROM table WHERE Published = $published";   
    $query=$this->db->query($query);
    return $query->getResultArray();
    }



View

Quote:<?= $pager->links() ?>




Thanks!
Reply


Messages In This Thread
Pagination - by Llui7 - 03-27-2021, 08:05 AM
RE: Pagination - by iRedds - 03-27-2021, 11:56 PM
RE: Pagination - by IvanBell - 03-28-2021, 01:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB