Welcome Guest, Not a member yet? Register   Sign In
[Solved] Delete row if key code is there for more than 15 min
#2

hye.
If i understand your issue, you want to delete all rows where date_modified (field in your table) are older than 15 minutes.

If you want it at every request who call your controller/method, you take the time at the controller access and you make a sql query which compare the time now et the time with date_modified. If delta between now and date_mdified > 15 minutes your delete the row. Use timestamp and you compare (15*60 seconds) between.
See sql query delete and had when your delta > 15*60 seconds.

If you want to delete rows when 15 minutes have passed without call your controller/method, develop a trigger in your database for example or a method using javascript for example combined with php to have the elapsed time, and after make your removal request.

Advices in your code : you will protect it more, one example among others, use $this->input->post('data', TRUE) and add rules for your form validation and perhaps use config file to store rules for your form validation.
Reply


Messages In This Thread
RE: Delete row if key code is there for more than 15 min - by casa - 02-05-2017, 03:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB