-1

在我的控制器中,我使用数组格式的学说从 db 中获取值。数组看起来像这样

Array(

[0] => Admin_Model_prod Object
    (
        [_id:protected] => 1         
        [_pname:protected] => mobile
        [_categoryname:protected] => device
        [_price:protected] => 10000
        [_status:protected] => sold

    )

[1] => Admin_Model_prod Object
    (
        [_id:protected] => 2         
        [_pname:protected] => tv
        [_categoryname:protected] => device
        [_price:protected] => 50000
        [_status:protected] => sold

    )

)

现在我想显示 id=1..

任何建议请

4

1 回答 1

1
$userId = Doctrine_Query::create()
        ->select('o.authorId')
        ->from("Offer o")
        ->where("o.id =$offerId")
        ->fetchArray();

像这样使用您的查询。你会得到一个数组而不是对象

于 2013-05-31T09:00:23.353 回答