title: pagination with CodeIgniter
body: <p>Hi i'm trying to get the pagination right with code igniter but it seems that it doesn't want to work correctly. I get the second page, but there the pagination disappears, I still got the right table though and I have 2 errors:</p>
  
  <pre><code>A PHP Error was encountered
  Severity: Notice
  Message: Undefined offset: 0
  Filename: models/evaluation_model.php
  Line Number: 37
  
  A PHP Error was encountered
  Severity: Notice
  Message: Trying to get property of non-object
  Filename: models/evaluation_model.php
  Line Number: 37
  </code></pre>
  
  <p>The controller function:</p>
  
  <pre><code>function showEvaluations($offset = 0)
          {
              if($this-&gt;login-&gt;is_logged_in())
              {
                  $limit = 5;
                  $result = $this-&gt;evaluation_model-&gt;getAllEvaluations($limit, $offset);
  
                  if ($this-&gt;session-&gt;userdata('type') == 'admin')
                  {
                      $data['evaluations'] = $result['evaluations'];
                      $data['total'] = $result['num_rows'];
                      $data['notallowed'] = false;
                      $config = array();
                      $config['base_url'] = base_url("evaluation/showEvaluations/");
                      $config['total_rows'] = $data['total'];
                      $config['per_page'] = $limit;
                      $config['uri_segment'] = 3;
                      $this-&gt;pagination-&gt;initialize($config);
                      $data['pagination'] = $this-&gt;pagination-&gt;create_links();
                      $this-&gt;load-&gt;view('allevaluations_view',  $data);
                  }
                  else
                  {
                      $data['notallowed'] = true;
                      $this-&gt;load-&gt;view('allevaluations_view',  $data);
                  }
  
  
                  //$this-&gt;load-&gt;view('allevaluations_view',  $data);
              }
              else
              {
                  $this-&gt;load-&gt;view('login_view');
              }
          }
  </code></pre>
  
  <p>and the Model:</p>
  
  <pre><code>function getAllEvaluations($limit, $offset)
          {
              $q = $this-&gt;db-&gt;select('tblPunten.PK_PuntID, tblPunten.Titel, tblPunten.Score, tblVakken.Vak, tblUsers.username, tblUsers.Voornaam, tblUsers.Achternaam')
                            -&gt;from('tblPunten')
                            -&gt;join('tblVakken', 'tblPunten.FK_VakID = tblVakken.PK_VakID')
                            -&gt;join('tblUsers', 'tblPunten.FK_UserID = tblUsers.PK_UserID')
                            -&gt;limit($limit, $offset);
  
              $query['evaluations'] = $q-&gt;get()-&gt;result();
  
              $q = $this-&gt;db-&gt;select('COUNT(*) as count', FALSE)
                            -&gt;from('tblPunten')
                            -&gt;limit($limit, $offset);
               $tmp = $q-&gt;get()-&gt;result();
               $query['num_rows'] = $tmp[0]-&gt;count;
               return $query;
  
  
          }
  </code></pre>
  
  <p>Line 37:  <code>$query['num_rows'] = $tmp[0]-&gt;count;</code></p>