You can use this:
if (is_null($row->primary_key))
{
    // row doesn't exist
}

But a method exist()/valid() in Zend_Db_Table_Row_Abstract will be useful.


xagrez schrieb:
> Same issue for me
> 
> the issue is that, whether if  a row is fetched in the fetchRow, it will
> still return an object.
> 
> There must be a way to access functions in that object to know if a row(s)
> is fetched.
> 
> 
> Shahar Evron wrote:
>> Hi,
>>
>> This might be a report, but I didn't find anything in the archives.
>>
>> I have some code like this:
>>
>> <?php
>>      // Assume that Users is a class extends Zend_Db_Table
>>      $table = new Users();
>>      $row = $table->fetchRow("user_name = 'bob'");
>> ?>
>>
>> What is the proper way to check whether I actually got a result or not?
>> I have noticed that fetchRow always returns a Zend_Db_Row object, and
>> that if there are no results (ie no rows where 'user_name' = 'bob') all
>> the data in the row is NULL.
>>
>> Does this make sense? If so, what's the intended way to check if results
>> were returned?
>>
>> TIA,
>>
>> Shahar.
>>
>>
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to