2

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

数组 ( [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;
    }
4

1 回答 1

1
return $row[0]->jobid;

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

于 2013-03-16T19:23:39.577 回答