Zend_Table_Db and Zend_Paginator and Zend_Paginator_Adapter_DbSelect
Posted
by Uffo
on Stack Overflow
See other posts from Stack Overflow
or by Uffo
Published on 2010-06-13T18:34:35Z
Indexed on
2010/06/13
21:12 UTC
Read the original article
Hit count: 540
I have the following query:
$this->select()
->where("`name` LIKE ?",'%'.mysql_escape_string($name).'%')
Now I have the Zend_Paginator code:
$paginator = new Zend_Paginator(
// $d is an instance of Zend_Db_Select
new Zend_Paginator_Adapter_DbSelect($d)
);
$paginator->getAdapter()->setRowCount(200);
$paginator->setItemCountPerPage(15)
->setPageRange(10)
->setCurrentPageNumber($pag);
$this->view->data = $paginator;
As you see I'm passing the data to the view using $this->view->data = $paginator
Before I didn't had $paginator->getAdapter()->setRowCount(200);
I could determinate If I have any data or not, what I mean with data, if the query has some results, so If the query has some results I show the to the user, if not, I need to show them a message(No results!)
But in this moment I don't know how can I determinate this, since count($paginator)
doesn't work anymore because of $paginator->getAdapter()->setRowCount(200);
and I'm using this because it taks about 7 sec for Zend_Paginator to count the page numbers.
So how can I find If my query has any results?
© Stack Overflow or respective owner