title: Retrieve database content based on dates and default to 7 days record
body: <p>I am trying to display records from the database and default them to weekly records.
  e.g I want to have the records to default to Ist of Nov 2013 - 7th of Nov 2013 (That's a week from now) then on clicking the previous link  25th of Oct - 31st of Oct (2013) and the next link 8th of Nov - 14th of Nov (2013)</p>
  
  <p><strong>I am using php and CodeIgniter. Any help or link to a page that can help me will be appreciated.</strong></p>
  
  <p>All am doing now is to display all records and use pagination to display 7 fields per page but I need to display per week and default to the current week from Friday to Thursday..</p>
  
  <pre><code>public function index()
  {
      //Count all records
      $shopID= $this-&gt;uri-&gt;segment(2);
      session_id($shopID);
      $this-&gt;db-&gt;where('BDP_COST_CENTRE_NUMBER', $shopID);
      $count =  $this-&gt;db-&gt;count_all_results('WHOUSE1.DLY_BWR_DLY_PERFORMANCE');
      //Set up pagination
      $perpage = 7;
      if ($count &gt; $perpage)
      {
          $config['base_url'] = 'http://bwr/index.php/daily_shop_performance/' . $shopID . '/';
          $config['total_rows'] = $count;
          $config['per_page'] = $perpage;
          $config['uri_segment'] = 3;
          $this-&gt;pagination-&gt;initialize($config);
          $this-&gt;data['pagination']=$this-&gt;pagination-&gt;create_links();
          $offset = $this-&gt;uri-&gt;segment(3);
      } else {
          $this-&gt;data['pagination']='';
          $offset = 0;
      }
      $shopID= $this-&gt;uri-&gt;segment(2);
      $this-&gt;db-&gt;where('BDP_COST_CENTRE_NUMBER', $shopID);
      $this-&gt;db-&gt;limit($perpage, $offset);
      **$this-&gt;data['shops_performances'] = $this-&gt;performance_m-&gt;get();**
      $this-&gt;data['subview'] = 'page/performance_page';
      $this-&gt;load-&gt;view('_layout_main', $this-&gt;data);
  }
  </code></pre>