PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 29, 2022

[FIXED] Deleting a specific row in SQL after dynamcic timeframe - PHP, MYSQL

 January 29, 2022     mysql, php, phpmyadmin     No comments   

Issue

Hey so i need a way to remove a row that is connected to a user after a dynamic time. Eg: Insert that your doing something for 15 minutes, after that 15 minutes i want to delete that row automatically.

There will be lots of rows (users doing stuff) in the database and i need them to all be removed after a custom time for each that is set by the user.

How would i go about this!

Thanks in advannce


Solution

You will need 2 things.

  1. a self_destruct_at or equivalent field that is a datetime. That will be set on creating the record.

  2. a worker process to go through ever X minutes (probably 1) and delete the comments that are older than the current time and the created_at + self_destruct_at time



Answered By - Austio
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing