title: Total number of results and limit in active records
body: <p>I am fetching some of the listings from the DB and displaying it in a paginated screens. But for the pagination, I need to take the total count of results. I am using Codeigniter and ActiveRecords. My query is something like this  :</p>
  
  <pre><code>$query = $this-&gt;db-&gt;select('sum(amount) as sum')
                -&gt;where(date_added between '$from' and '$to')
                -&gt;group_by('date_added')
                -&gt;get('my_table');
  </code></pre>
  
  <p>I need to run this query with and without the limits for getting total number of values and to get the paginated output with limits. Now I need to copy the query again and run it with the limits. Is there any other way so that I can copy the complete query object to another variable and call the get again ? </p>