0

Counting query records / pagination

Hi all

Is there a way for me to get a count of the total records ie. like a SELECT COUNT(*) query?

I am attempting to add application-level pagination with Zend_Paginator. This paginator requires the total count of items as input, in order to generate the page links correctly. Currently I am doing this as follows:

1. First run the YQL query as SELECT * from table (0) WHERE... and access the yahoo:count element to get the total count of results
2. Initialize thepaginator
3. Run the YQL query again with LIMIT and OFFSET parameters to get the data set for the current page.

This is not very elegant but I could not find another way. In effect I am running the first query on each request, which is not efficient. Can someone suggest a better way or point me to any PHP code examples that implement paging with YQL?

Thanks

by
0 Replies

Recent Posts

in YQL