|
|||
|
Here:
Zend Framework: Documentation .db.select.building.limit And here: Paging Data Sets With PEAR Pager EAR-Pager It seems the two articles use different LIMIT clause syntax. The manual is: LIMIT <limit>, [<skip>] But the tutorial on Pager is: LIMIT [<skip>,]<limit> I am wondering, which is the correct one? or we can use both? |
|
|||
|
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}]
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. |
|
|||
|
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|