Search code examples
phpzend-frameworkgdata

How many results were returned?


I'm performing a query on a worksheet. I want to update the row if it exists or insert it if it doesn't. How can you check if a result was returned or not?

$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($this->currKey);
$query->setWorksheetId($this->currWkshtId);
$query->setSpreadsheetQuery('cid = ' . $data['cid']);
$listFeed = $this->gdClient->getListFeed($query);

// This does not work!
if(empty($listFeed)){
 echo 'No results found!';
}

Solution

  • It looks like you want

    if(empty($listFeed->entries)){
        echo 'No results found!';
    }
    

    As Dagon suggested (perhaps a bit tersely), including some var_dump output will be helpful if this doesn't work.