title: Codeigniter search with pagination
body: <p>i have implemented search with pagination.
  Controller function `public function search()
      {</p>
  
  <pre><code>    if($_POST)
      {
          $search_name=$this-&gt;input-&gt;post('search_name');
          $config['base_url'] = 'search';
          $config['total_rows'] = 15;//$this-&gt;registration_model-&gt;record_count();
          $config['per_page'] = 4;
          $config["uri_segment"] = 3;
          $config['use_page_numbers'] = TRUE;
          $this-&gt;pagination-&gt;initialize($config);
          $page = ($this-&gt;uri-&gt;segment(3)) ? $this-&gt;uri-&gt;segment(3) : 0;
          $data['result']=$this-&gt;institute_model-&gt;search_result($config["per_page"],$page,$search_name);
          $data['links'] = $this-&gt;pagination-&gt;create_links();
          $this-&gt;load-&gt;view('institute/search',$data);
      }
  }`
  </code></pre>
  
  <p>And Model function code is </p>
  
  <pre><code>public function search_result($limit,$start,$search_name)
  {
      $this-&gt;db-&gt;limit($limit, $start);
      $this-&gt;db-&gt;select('user_id');
      $this-&gt;db-&gt;where('category',1);
      $this-&gt;db-&gt;like('first_name',$search_name);
      $query = $this-&gt;db-&gt;get('registration');
      if ($query-&gt;num_rows() &gt; 0) {
  
          foreach ($query-&gt;result() as $row) {
  
              $data[] = $row;
  
          }
  
          return $data;
  
      }
  
      return false;
  
  
  
  
  }
  </code></pre>
  
  <p>I am searching from registration table having userid and fname etc. searching is based on username. It works for me but when i click page 2 on pagination it goes to <code>http://localhost/mypro/index.php/institute/search/2</code> and goes blank.</p>