![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
Programming question
How to handle auto delete posts in mysql ?
i am working on webapp where users upload pics and choose expire date in future e.g. 10 minutes, 1 hour, 1 day, 1 month, 6 months, 1 year from the date of post creation. How can i delete only those posts which are set for auto delete and whose date is expired ? i can think of many ways., but cant decide which one to choose . obviously cron job every minute will delete the expired posts., so should i save post_creation_date and post_expiration_date in datetime format or in unix timestamp format. Thanks for your time. i need logic, i can code mysqlf. anybody ?
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Bollocks
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,793
|
I would have an expiration time in unix timestamp format, and when pulling out rows to display them or whatever else, have a condition on the query that only pulls rows that are before their expiration time. So rows that have gone past the expiration time appear to have been deleted even though they're still in the database. Then you can periodically delete them properly.
__________________
Interserver unmanaged AMD Ryzen servers from $73.00 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
God Bless You
Industry Role:
Join Date: Aug 2014
Location: Glasgow, $cotland
Posts: 1,467
|
keep your server time & unix timestamp format to avoid people from time zone +12 or -12
![]()
__________________
magneto664 📧 gmail.com Adult Backlinks 💘Best Website Stats 💘 Best CDN for Adult Content My Fav: 👍Chaturbate 👍 Stripchat 👍 Dateprofits 👍 AdultFriendFinder |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
Quote:
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
Quote:
but i get your point. but that doesnt matter in my case, as while inserting records current time + expire after time = expiration time. so there is no timezone issue., i guess., but i may be wrong.
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
|
i can think it like this way.
post creation time = X post expiration timeframe (10 minutes, 1 hour, 1 day etc) = Y post expiration time = Z X + Y = Z and my query would become, if Z > current time { remove records. } but Z gets changed everytime user edits post and changes expiration timeframe. thanks
__________________
SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |