Page 1 of 1

Selecting UNIX time within the SQL statment?

Posted: Sun Sep 03, 2006 7:17 pm
by alexus
Hi
i know im close to what i want but cant get it right :-(

here is what i have, user logs in and time() unix timestam is recirded, now i wan to find out who loged in within last 30 sec so i do:

SELECT * FROM users WHERE timestamp >= ROM_UNIXTIME(0)-30;

But that doesnt work... :-( can some one corect me? thanks!

Posted: Sun Sep 03, 2006 9:04 pm
by feyd
UNIX_TIMESTAMP(NOW()) - 30

Posted: Sun Sep 03, 2006 9:21 pm
by alexus
ok thanks!
will try that
I was so furstrated so I did a buffer

Code: Select all

$timestamp=time()-30
SLECT ... WHERE timestamp >= '$timestamp';