title: Codeigniter pagination problem
body: <p>I basically can’t get the pagination bit to work, I did before I changed my database query and now I’m stuck.</p>
  
  <p>My model looks like:</p>
  
  <pre><code>function get_properties($limit, $offset) {
     $location = $this-&gt;session-&gt;userdata('location');
     $property_type = $this-&gt;session-&gt;userdata('property_type');
     if($property_type == 0) 
     {
        $sql = "SELECT * FROM properties ";
     }
     // more queries here
     $sql .= " LIMIT ".$limit.", ".$offset.";";
     $query = $this-&gt;db-&gt;query($sql);
     if($query-&gt;num_rows() &gt; 0) {
        $this-&gt;session-&gt;set_userdata('num_rows', $query-&gt;num_rows());
        return $query-&gt;result_array();    
        return FALSE;
        }
     }
  } 
  </code></pre>
  
  <p>and my controller looks like:</p>
  
  <pre><code>function results() {
     $config['base_url'] = base_url().'/properties/results';
     $config['per_page'] = '3';
     $data['properties_results'] = $this-&gt;properties_model-&gt;get_properties($config['per_page'], $this-&gt;uri-&gt;segment(3));
     $config['total_rows'] = $this-&gt;session-&gt;userdata('num_rows');
     $this-&gt;pagination-&gt;initialize($config);
     $config['full_tag_open']='&lt;div id="pages"&gt;';
     $config['full_tag_close']='&lt;/div&gt;';
     $data['links']=$this-&gt;pagination-&gt;create_links();
     $this-&gt;load-&gt;view('properties_results',$data);
  } 
  </code></pre>
  
  <p>please help…its screwing up! </p>