Re: mysql_fetch_object() equivalent for mongoDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Actually, there is no statement in PHP that can return data from
MongoDB as object (CMIIW). Data are returned as array.
You can convert this array to object using (object).
Look an example at
http://www.richardcastera.com/blog/php-convert-array-to-object-with-stdclass

$posts = (object) $mongo->find();
echo 'Id: ' . $posts->Id;

-- 
Duken Marga

On Wed, Sep 7, 2011 at 1:28 PM, chamila gayan <cgchamila@xxxxxxxxx> wrote:
> hi all,
>
> Is anybody aware of mysql_fetch_object() equivalent/similar implementation
> for mongoDB?
> thanks..
>
> ~Chamila Gayan
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux