title: Codeigniter: Retrieving a variable from Model to use in a Controller
body: <p>I bet this is easy but been trying for a while and can't seem to get it to work. Basically I am setting up pagination and in the model below I want to pass $total_rows to my controller so I can add it to the config like so '$config['total_rows'] = $total_rows;'.</p>
  
  <pre><code>function get_timeline_filter($per_page, $offset, $source) 
      {
          $this-&gt;db-&gt;where('source', $source);
          $this-&gt;db-&gt;order_by("date", "desc");
          $q = $this-&gt;db-&gt;get('timeline', $per_page, $offset);
          $total_rows = $this-&gt;db-&gt;count_all_results();
  
          if($q-&gt;num_rows() &gt;0) 
          {
              foreach ($q-&gt;result() as $row) 
              {
                  $data[] = $row;                 
              }
              return $data;
          }
  
      }
  </code></pre>
  
  <p>I understand how to pass things form the Controller to the model using <code>$this-&gt;example_model-&gt;example($something);</code> but not sure how to get a variable from the model?</p>