Tuesday, August 21, 2012

Re: I want to find records during last 24 hours

Ok, try with this:

$users = $this->User->find('all', array('conditions' => array('User.last_seen BETWEEN NOW() -INTERVAL 1 DAY AND NOW()'), 'recursive' => -2);

I have doubt about INTERVAL sintax but this is the correct sintax for cakephp.

--
Murgan, Alexis Germán
Desarrollador & Diseñador
Web: german.murgan.com.ar
Email: german@murgan.com.ar
MSN: german@murgan.com.ar
Móvil: +5493424663813


2012/8/21 MetZ <metz80@gmail.com>
Hi..

No,, that one also return empty array :(

Thanks anyway! any other suggestion?

-Tom


kl. 20:19:16 UTC+2 tirsdag 21. august 2012 skrev Mancho Murgan følgende:
Try with this sintax:

$users = $this->User->find('all', array('conditions' => array('User.last_seen BETWEEN NOW() AND NOW() -INTERVAL 1 DAY'), 'recursive' => -2);

--
Murgan, Alexis Germán
Desarrollador & Diseñador
Web: german.murgan.com.ar
Email: ger...@murgan.com.ar
MSN: ger...@murgan.com.ar
Móvil: +5493424663813


2012/8/21 MetZ <met...@gmail.com>

How can I find the Users that are "last_seen" the last 24hours?

  [User][last_seen] => 2012-08-18 08:10:31

last_seen is updated each time a logged in user browse the website with current timestamp

This is what I have tried this far:

  $users = $this->User->find('all',array('conditions'=>array('User.last_seen >' =>'BETWEEN NOW() AND NOW()- INTERVAL 24 HOURS'),'recursive'=>-2));

But my array is coming back empty.

Suggestions??

As always!! You are awesome! Thanks for your time!

-Tom

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate