(1-1/1)
I fixed it, it was a stupid bug on my part.
Fixed with this:
$usersonline = User::all(array('conditions' => 'lastactivity >= UTC_TIMESTAMP() - INTERVAL 15 MINUTE', 'order' => 'lastactivity DESC'));
The PHP app is set to use UTC, but the server time is EST... =]
(1-1/1)
June 27 2010
December 20, 2010 00:00
Subject: Custom SQL Select with MySQL Timestamp column?
I'm working on a simple forum like application. I'm fighting timestamps right now (they have always been my weak spot).
Is there a simple way to add a condition to a Model::all() to only find records with a timestamp column less than X minutes old?
What I am playing around with (and isn't working - returns 0 results):
`lastactivity` is a MySQL TIMESTAMP column with a value of `YYYY-MM-DD HH:MM:SS`.