$this->select()->from($this, $cols);
Should be:
$this->select()->from('your_table_name', $cols);
Also, so I'm covering all my bases, I assume you've read the user guide:
http://framework.zend.com/manual/en/zend.paginator.usage.html
Hope that helps,
-Matt
On Thu, Oct 23, 2008 at 9:26 PM, ashish.sharma <
[EMAIL PROTECTED]> wrote:
>
> I am using the following code WITHOUT using fetchAll() .. am I doing it
> right?
>
> ======================================================
> $select = $this->select();
>
> $select->from($this, $cols);
>
> if ($where) {
> $select->where($where);
> }
>
> if ($order) {
> $select->order($order);
> }
>
> Zend_Loader::loadClass('Zend_Paginator');
> $objPaginator = Zend_Paginator::factory($select);
>
> ==========================================================
>
> Please correct me where I am wrong.
>
> Thanks
> Ashish Sharma
>
>
>
> Matthew Ratzloff wrote:
> >
> > print_r() will not work.
> > You should not fetch the rows. You should pass the Select object
> directly
> > to the Paginator's factory() method. It only selects the rows necessary.
> >
> > -Matt
> >
> > On Thu, Oct 23, 2008 at 6:31 AM, ashish.sharma <
> > [EMAIL PROTECTED]> wrote:
> >
> >>
> >> Nothing seems to be working.
> >>
> >> Used the code snippet but when I "print_r()" he paginator then I am not
> >> able
> >> to see the total number of records, total pages formed etc.
> >>
> >> Also, I m not sure whether use of fetchAll is appropriate or not. What
> is
> >> the use of fetching all the records? Can't we do something like .. just
> >> fetch the rows to be displayed and the count(*) of the query to get the
> >> total records.
> >>
> >> Kindly advice!
> >>
> >> Ashish Sharma
> >> TL R&D
> >>
> >>
> >>
> >> 411161 wrote:
> >> >
> >> > I have it working, but I am not sure how to create links for next,
> >> last,
> >> > first, previous, numbers, etc.. I am also not sure how to handle links
> >> in
> >> > my controller.
> >> > This is what I have so far."
> >> >
> >> > controller:
> >> > public function paginateAction() {
> >> >
> >> > $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713';
> >> > $this->view->result = $this->db->fetchAll($sql);
> >> > $paginator =
> >> Zend_Paginator::factory($this->view->result);
> >> > $paginator->setCurrentPageNumber(15);
> >> > $this->view->paginator = $paginator;
> >> > }
> >> >
> >> > in my view I have:
> >> > <table>
> >> > <?
> >> > foreach($this->paginator as $key => $row){
> >> >
> >> > echo "<tr><td>" .$row['EMPL_NO']
> >> . "</td>\n";
> >> > echo "<td>" .$row['PRISM_ORG_CODE']
> >> . "</td></tr>\n";
> >> > }
> >> > ?>
> >> > </table>
> >> >
> >> > How do I create the links and I how do I handle the action so that it
> >> will
> >> > not try and call the sql again?
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p20131009.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p20144017.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>