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

[eluser]Wonder Woman[/eluser]
I have a search form and in the model the sql puts itself together depending on what data has been submitted etc.

Anyways this has caused havoc with my pagination, I just can't seem to get it to work like it used to, I think its to do with the offset, my controller looks like:

Code:
$config['per_page'] = '3';

$config['total_rows'] = '5';

$data['properties_results']=$this->properties_model->get_properties($config['per_page'], $this->uri->segment(3));
        
$this->pagination->initialize($config);

and my model looks like:


Code:
function get_properties($limit, $offset) {
   $property_type = $this->session->userdata('property_type');
   $sql = "SELECT * FROM properties WHERE ";
   if($property_type != 0)
   {
      $sql .= " property_type = '".$property_type."'";
   }
  
   // more queries here

   $sql .= " LIMIT ".$limit." ".$offset.";";
   $query = $this->db->query($sql);
   $num_rows = $query->num_rows();
   if($query->num_rows() > 0) {
      return $query->result_array();    
      return FALSE;
   }
}

Where am I going wrong? Thanks
#2

[eluser]Wonder Woman[/eluser]
Can anyone help? I'm stuck on how to get it to paginate correctly, its just showing the same results per page. Thanks.
#3

[eluser]maria clara[/eluser]
try to check out this link http://ellislab.com/forums/viewthread/143280/ hopes this could help.

regard,
maria
#4

[eluser]Unknown[/eluser]
Hi there is thmas65,

Whether this is relevant or not, I think you would benefit from reading this, Eelixduppy posted this years ago (and much kudos to him for it Smile), and it helped me to understand the mechanics on pagination, and rather than re post whats been said & discussed, read this and all will become clear.


__________________________________________________________________________________________
Earn an Extra $1000 to $1200 per month doing Part Time Data Entry Jobs! Work from home data entry jobs to post simple data submissions on Internet. Make $1 per entry. Easy form filling, data entry and ad posting jobs. No selling, No phone calls, No Marketing. No Investment. Bi-weekly payments. Full Training Provided. Pls visit:  Data-Entry 




Theme © iAndrew 2016 - Forum software by © MyBB