title: CodeIgniter Database query limit
body: <p>I'm doing some db querys using ActiveRecord and i need to paginate the results so i do a</p>
  
  <pre><code>$this-&gt;db-&gt;limit($pPagination['Start'], $pPagination['Length']);
  </code></pre>
  
  <p>but i don't get any results. Using <code>$this-&gt;db-&gt;last_query();</code> it seems that CodeIgniter  produces the following SQL</p>
  
  <pre><code>SELECT *
  FROM (`viw_contacts`)
  WHERE `user_id` = '1'
  ORDER BY `contact_name` asc
  LIMIT 0 OFFSET 15
  </code></pre>
  
  <p>which when i run it inside PHPMyAdmin also returns 0 rows.</p>
  
  <p>But if i modify it an run :</p>
  
  <pre><code>SELECT *
  FROM (`viw_contacts`)
  WHERE `user_id` = '1'
  ORDER BY `contact_name` asc
  LIMIT 0, 15
  </code></pre>
  
  <p>Then i get the correct results. Any ideea why CodeIgniter generates this SQL and why it doesn't work?</p>
  
  <p>I use CodeIgniter 1.7.3 and MySQL 5.1.41</p>