Tuesday, January 18, 2011

retrieve data from find result array

Hi,

I have a model Status with fields 'name', 'time', of which 'time' is a
timestamp. I perform a find query and try to cast timestamp as date:

$status = $this->Status->find('all', array('fields' => array('CAST
(Status.time AS DATE) time')));

debug($status) gives me :

Array
(
[0] => Array
(
[Status] => Array
(
[name] => AF1234
)

[0] => Array
(
[time] => 2010-12-02 15:05:11
)

)

)

How do I retrieve the time data from the array? $status[0]['time']
does not work.

Thanks,
ojonam

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate