Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007, 12:11 PM
matias.quaglia's Avatar
Junior Member
 
Join Date: Aug 2007
Posts: 18
Default Wannabe question find($id) vs fetchRow("id = $id")

Hi, i'm trying to understand the differences between the find($id) method and the fetchRow("id = $id") method.

When I try to use find, i get that i don't get any row, but when i use fetchRow I do.

Please could something explain me a little about this?

Here I paste something of my controller action:

With find (it seems that i don't get the row)
PHP Code:
            $id $this->_getParam('id');
            
            
$imagen = new Image();
            
            
$imagenData $imagen->find($id);
            
            if (
$imagenData) {
                
$this->view->imagen $imagenData;
                
$this->view->error 0;
            } else {
                
$this->view->error 1;
                
$this->view->mensaje "La imagen pedida ya no existe";
            } 
And with fetchRow (it works really fine):

PHP Code:

            $id 
$this->_getParam('id');
            
            
$imagen = new Image();
            
            
$imagenData $imagen->fetchRow("id = $id");
            
            if (
$imagenData) {
                
$this->view->imagen $imagenData;
                
$this->view->error 0;
            } else {
                
$this->view->error 1;
                
$this->view->mensaje "La imagen pedida ya no existe";
            } 
__________________
Matías Quaglia
==========
http://www.matiasquaglia.com.ar
Credo est Creo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-03-2007, 10:38 AM
Junior Member
 
Join Date: Sep 2007
Posts: 3
Default

fetchRow () returns a row
but find () returns a rowset

so, basically you can use find() like this:
PHP Code:
$rows $imagen->find($id);
$imagenData $rows[0]; 
Please refer to the API doc:
Docs For Class Zend_Db_Table_Abstract
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB 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 03:48 PM.