Welcome Guest, Not a member yet? Register   Sign In
Pagination [doing my head in]...anyone...please?
#1

[eluser]Wonder Woman[/eluser]
Hi,

I basically can't get the pagination bit to work, I did before I changed my database query and now I'm stuck.

My model looks like:

Code:
function get_properties($limit, $offset) {
   $location = $this->session->userdata('location');
   $property_type = $this->session->userdata('property_type');
   if($property_type == 0)
   {
      $sql = "SELECT * FROM properties ";
   }
   // more queries here
   $sql .= " LIMIT ".$limit.", ".$offset.";";
   $query = $this->db->query($sql);
   if($query->num_rows() > 0) {
      $this->session->set_userdata('num_rows', $query->num_rows());
      return $query->result_array();    
      return FALSE;
      }
   }
}

and my controller looks like:

Code:
function results() {
   $config['base_url'] = base_url().'/properties/results';
   $config['per_page'] = '3';
   $data['properties_results'] = $this->properties_model->get_properties($config['per_page'], $this->uri->segment(3));
   $config['total_rows'] = $this->session->userdata('num_rows');
   $this->pagination->initialize($config);
   $config['full_tag_open']='<div id="pages">';
   $config['full_tag_close']='</div>';
   $data['links']=$this->pagination->create_links();
   $this->load->view('properties_results',$data);
}

please help...its screwing up!


Messages In This Thread
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 04:06 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 07:35 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 07:36 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 07:49 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 07:52 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 08:03 AM
Pagination [doing my head in]...anyone...please? - by El Forum - 08-27-2010, 08:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB