Solarpitch Posted October 29, 2006 Share Posted October 29, 2006 Hey Guys ,I have an application that involeves user's uploading an add to sell a product. The user gets to select whether they want the add to run online for..1 day3 days5 days1 weekIs there a way or some code that I can use that automically removes the add from the database, based on the system date and time? So if user selects 1 day . . 24 hours from the time it was uploaded it will be automatically deleted or better still . . deleted and stored in an admin table!Cheers, Gerard. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 29, 2006 Share Posted October 29, 2006 [code]<?php$period = 5; // how many days$expiry_date = date('Y-m-d', strtotime("+$period days"));?>[/code]Write the expiry date to the ad record.To remove old recordsmysql_query ("DELETE FROM ads WHERE expiry_date < CURDATE()"); Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted October 29, 2006 Author Share Posted October 29, 2006 Thats simple huh! lol . . brilliant . . thanks a mill! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.