Zend数据库不会产生价值

时间:2013-03-16 19:18:51

标签: php database zend-framework

请帮忙!知道为什么要打印:

数组([0] => stdClass对象([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;
    }

1 个答案:

答案 0 :(得分:1)

return $row[0]->jobid;

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