PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Querying for a Single Row

You can query for a single row using criteria similar to that of the fetchAll() method.

Example 293. Example of finding a single row by an expression

<?php
$table 
= new Bugs();

$select  $table->select()->where('bug_status = ?''NEW')
                           ->
order('bug_id');

$row $table->fetchRow($select);

This method returns an object of type Zend_Db_Table_Row_Abstract. If the search criteria you specified match no rows in the database table, then fetchRow() returns PHP's NULL value.

Zend Framework