Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework Components > Databases

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-2008, 01:02 PM
Junior Member
 
Join Date: Jan 2008
Posts: 2
Default How can I get the number of rows in a query?

I know that the atribute _count stores the value, but how can I get it if it's protected? Is there another way to get this value?

in the controller:
[PHP]$this->view->comentarios = $comentarios->fetchAll($where, $order, $count, $offset);[/PHP]

in the view:
[PHP]<?php echo $this->comentarios->_count ?>[/PHP]

and i get this:

Fatal error: Cannot access protected property Zend_Db_Table_Rowset::$_count in
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 04:01 PM
Junior Member
 
Join Date: Jan 2008
Posts: 2
Default

ok, I use this and worked.
[PHP]
count($this->comentarios);
[/PHP]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-22-2008, 05:49 AM
Member
 
Join Date: Jun 2007
Posts: 35
Default

count() is how I always do it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 02:19 AM.


Designed by: Miner Skinz Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0