$offset not working for pagination codeigniter

后端 未结 2 2002
轻奢々
轻奢々 2021-01-26 00:32

I am trying to implement Pagination into my searchresults page. I\'ve asked this question yesterday with no succes Records not limited on searchpage using codeigniter pagination

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-26 01:10

    You need your limit/offset inside the $querystring:

    $query = "SELECT * FROM (`bedrijfcategorieen`) 
            JOIN `bedrijven` ON `bedrijfcategorieen`.`idbedrijven` = `bedrijven`.`idbedrijven` 
            JOIN `categorieen` ON `bedrijfcategorieen`.`idcategorieen` = `categorieen`.`idcategorieen` 
            WHERE (`Bedrijfsnaam` LIKE '%".$this->input->post('search')."%' 
            OR `Plaats` LIKE '%".$this->input->post('search')."%' 
            OR `Telefoonnummer` LIKE '%".$this->input->post('search')."%' 
            OR `Email` LIKE '%".$this->input->post('search')."%' 
            OR `Website` LIKE '%".$this->input->post('search')."%' 
            OR `Profiel` LIKE '%".$this->input->post('search')."%' 
            OR `Adres` LIKE '%".$this->input->post('search')."%' 
            OR `Categorie` LIKE '%".$this->input->post('search')."%') 
            AND (Postcode IN ($string)) 
            GROUP BY `Categorie`,  `bedrijfcategorieen`.`idbedrijven` 
            LIMIT ".$offset.", ".$limit;
    
           $result = $this->db->query($query);
           return $result->result_array();
    

提交回复
热议问题