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

[eluser]noname525[/eluser]
vv
#2

[eluser]skunkbad[/eluser]
What is wrong with COUNT(*) as count OR $this->db->count_all_results()?

I'm having a hard time understanding how you obtaining a true count when you are also using LIMIT in the same query.
#3

[eluser]ludo31[/eluser]
try to adapt your code with that

Code:
public function getHomme ($limit ,$offset)
       {
        

          
          
           $this->db->select('id,nom,prix,nom_marques,nom_path,quantite,semelle_interieure,libelle_fermeture,
                  libelle_style,libelle_talon,libelle_doublure,libelle_semelle,libelle_dessus,libelle_genre');
           $this->db->from('chaussure');
           $this->db->join('gnr_convenir', 'gnr_convenir.identifiant_chaussure = chaussure.id');
          
            $this->db->join('genre', 'genre.idgenre= gnr_convenir.identifiant_genre  ');
          
           $this->db->join('imageprincipale', 'imageprincipale.id_chaussure = chaussure.id');
           $this->db->join('marques', 'marques.idmarques = chaussure.identifiant_marques');
           $this->db->join('fermeture', 'fermeture.idfermeture = chaussure.identifiant_fermeture');
           $this->db->join('style', 'style.idstyle = chaussure.identifiant_style');
           $this->db->join('talon', 'talon.idtalon = chaussure.identifiant_talon');
           $this->db->join('doublure', 'doublure.iddoublure = chaussure.identifiant_doublure');
           $this->db->join('materiauSemelle', 'materiauSemelle.idmateriauSemelle = chaussure.identifiant_semelle');
           $this->db->join('dessus', 'dessus.iddessus = chaussure.identifiant_dessus');
           $this->db->where('identifiant_genre', 1);  
           $this->db->order_by("id", "desc");
    $this->db->limit($limit,$offset);
          
        $query = $this->db->get();
          
           $ligne= $query->num_rows();
          
                    if($query->num_rows()>0)
                       {
                         foreach($query->result_array()as $row)
                         {
                           $data[] = $row;
                         }
                        
                           $data['ligne'] = $ligne;
                      
                         return $data;
                        
                        
                       }
          
          
                      
                      
          
          
          
       }


the number of rows is

$ligne= $query->num_rows();




Theme © iAndrew 2016 - Forum software by © MyBB