php - Zend Database 不产生值(value)

标签 php database zend-framework

求助!知道为什么要打印:

Array ( [0] => stdClass Object ( [jobid] => 1 ) ) 而不是它的值?

    $this->dbo->setFetchMode(Zend_Db::FETCH_OBJ);
    $userOffer = $this->dbo->select()
    ->from('offer', array('jobid'))
    ->where('userid'.' = ?', $userID);

    $userAccept = $this->dbo->select()
    ->from('acceptance', array('jobid'))
    ->where("userid".' = ?', $userID);

    $select = $this->dbo->select()
    ->union(array($userOffer, $userAccept))
    ->order("jobid");

    while ($row = $this->dbo->fetchAll($select)) { 
        print_r ($row);
        //return $row;
    }

最佳答案

return $row[0]->jobid;

改用它。您需要返回作为对象的行索引,然后访问属性 jobid。这就是您执行此操作的方式,因此它返回 1 的值。

关于php - Zend Database 不产生值(value),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15453594/

相关文章:

javascript - Zend 1.12 : Append javascript to bottom of view

PHP、MySQL : how to select random records without RAND (attempt to avoid RAND())

mysql - 如何从 MySQL 中的单个表中获取不同的计数

mysql - Zend db 更新值未设置

sql数据库表创建

php - zend_PDF drawImage 用于设置位置

php - mysql中的多词查询

php - 将ajax中的变量从一个页面传递到另一个页面

php - 将 PHP 页面拆分为 2 个域 - 将变量发送到第二个域并再次返回

php - Zend|Db\Sql|表达式在 Zend SL 语句中不起作用