views:

10

answers:

0

My apologies up front for being a) a newbie and b) almost certainly not giving enough info.

So I have app that uses ZF to fetch data from MySQL and display it to the user.

The user can select a row of data and fetch additional information (username, hostname, etc...).

I'm having an issue with PHP puking when ZF returns null data from the following function:

#phtml code that displays data to the user

    <dt>User</dt>
    <dd>
     <?=$this->userAction->findParentManage_Model_DbTable_Employee()->getDisplayValue()?>
    </dd>

#php code that is called by the line above
            public static function getDisplayValue(Zend_Db_Table_Row_Abstract $row, $context = null)
            {
                return $row->firstName . ' ' . $row->lastName; 
            }

The result of this is supposed to convert a generic login ID (abc123) to a human readable name "Joe Montana".

However sometimes the input Login ID is invalid (NULL | Blank | or otherwise bad) this results in 0 rows returned for the SQL query.

When this occurs I end up with "Fatal error: Call to a member function getDisplayValue() on a non-object" pointing to the line of phtml posted above.

All I want to do is determine if SQL returned data and if so print it. If not, print "not found".

Any help would be appreciated

Thanks