duankuaizhe8257 2014-04-13 10:38
浏览 24

如何在特定时间后停用或删除数据库中的项目? [关闭]

I have a project that requires me to develop a website say like ebay or craigslist where users will be uploading ads and items for sale or maybe advertisement purposes. I want the users to have an option of duration that how long they would want their items to remain on the website. Let say the options are 7 days, 15 days and 30 days, if a user selects 15 days for his/her item to remain on the website, I want a simple and reliable solution that automatically deactivates or removes this specific item from the database after 15 days at exactly the same time of upload. (Must be accurate up to minutes and even seconds). Since I love php so much, I would also love if the answer is simply possible in php. Anyway, if there is another solution more reliable let me know it. I have been considering setting a $_SESSION[] and then destroying it after the time limit but I have this feeling that it may not be the best approach available. Whatever,,,,, Please help me out, Please explain. Thank you in advance.

  • 写回答

1条回答 默认 最新

  • doudi8519 2014-04-13 10:43
    关注

    This may help you.

    DELETE FROM table WHERE delete_date >= (CURDATE() - INTERVAL 7 DAY);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制