I have a db with some customers data. There I store their last login time as datetime.
I want to run a cron php script every min which will query mysqli for their last login datetime and if that was more than 20 mins in the past i will run some js popup etc (something like NOW() - last_login).
Anyway I am trying to query the db directly for that kind of users based on that 20 min time difference.
With php it's easy to filter results but I want to bring directly results from my mysql db without any intermediate process from php.
How can I accomplish this?
"SELECT * FROM tbl_name WHERE dt_column < DATE_SUB(NOW(), INTERVAL 20 MINUTE)"
This brings all entries were last login dt was more than 20 mins in the past.