View Single Post
  #1 (permalink)  
Old 12-13-2007, 03:11 AM
conradwt conradwt is offline
Member
 
Join Date: Nov 2007
Posts: 33
Question Obtaing A Single Model Instance Based On SQL Constraint

Hi, why doesn't the following return a rowset containing one row? In short, I have a model called Animal and I would like to get a row based on a constraint:

PHP Code:
function updateAction() {

        
$this->view->title "Update Animal";

        
$episode = new Animal();
        
$sql "SELECT * FROM animals WHERE is_rare = 1 ORDER BY id DESC LIMIT 1";
        
$this->view->currentAnimal $animal->fetchAll$sql );

      } 

Last edited by conradwt : 12-13-2007 at 03:28 AM.
Reply With Quote