View Single Post
  #2 (permalink)  
Old 05-23-2008, 12:58 AM
jasonw jasonw is offline
Junior Member
 
Join Date: May 2008
Posts: 12
Default

This is how MySQL (since 3.23, I believe), will allow you to do LIMIT clauses (:

Code:
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
That is, how you do it in a raw SQL query.
The cause of your confusion comes from the fact you are using Zend_Db_Select`s limit() method, which takes it`s arguments as ->limit($count, $offset).

So, technically both are correct. The latter being correct for ACTUAL SQL, and the former correct for Db_Select objects.

However, I HIGHLY recommend, if you are using Zend_Db_Select objects to build your queries, using the built in limitPage() method.

Its use is simple:
limitPage($pageNumber, $pageLength)

This saves you having to calculate your offset beforehand.

Last edited by jasonw : 05-23-2008 at 01:01 AM.
Reply With Quote