Welcome Guest, Not a member yet? Register   Sign In
how to clear a field in database in x mins?
#4

When you create the code and store it in the DB, also create a timestamp:


Code:
insert into whatever_table
(user_id, code, created_at)
values( ?, ?, NOW() );


Then when you want to check for a valid code:


Code:
select * from whatever_table
where user_id = ?
and code = ?
and created_at > ( NOW() - interval 1 hour );
Reply


Messages In This Thread
RE: how to clear a field in database in x mins? - by skunkbad - 07-13-2018, 11:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB