Welcome,
I would know if a member of my site (php - mySql) is Online.
I have in ma database a field (timestamp) with the time of his last action.
I must now compare this timestamp with the actual time.
for example, to compare for have an age I could make:
YEAR(FROM_DAYS(1 + TO_DAYS(CURDATE()) - TO_DAYS(birthday))) as age
now, I would the code for have a difference of minutes;
5 or less: online
more of 5: offline.
Thanks.