Gnarly Posted August 5, 2009 Share Posted August 5, 2009 I am completely lost on this. I'm creating a mod for a forum. This mod will allow users to purchase a subscription in 1 month, 3 months and 1 year packages. I need a query that will insert the date 1 month, 3 months or 1 year from the time they purchase it and when that day comes I need it to automatically change their access from 1 to 0. Quote Link to comment https://forums.phpfreaks.com/topic/168873-timer/ Share on other sites More sharing options...
abazoskib Posted August 5, 2009 Share Posted August 5, 2009 check out the date_add function in the mysql manual http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html also, you don't need to have an access column with a 1 or a 0. just check if the value for length of subscription is filled. if it is null then they are not subscribed. its not good practice to store redundant data. Quote Link to comment https://forums.phpfreaks.com/topic/168873-timer/#findComment-891005 Share on other sites More sharing options...
RichardRotterdam Posted August 5, 2009 Share Posted August 5, 2009 I am completely lost on this. I'm creating a mod for a forum. This mod will allow users to purchase a subscription in 1 month, 3 months and 1 year packages. You can do that with a query what do you have so far? I need a query that will insert the date 1 month, 3 months or 1 year from the time they purchase it and when that day comes I need it to automatically change their access from 1 to 0. You will need a cron job for this or scheduled task what ever you call it on windows Quote Link to comment https://forums.phpfreaks.com/topic/168873-timer/#findComment-891124 Share on other sites More sharing options...
kickstart Posted August 5, 2009 Share Posted August 5, 2009 Hi This would give you a date 3 months in the future:- now( ) + INTERVAL 3 MONTH You could easily use this to update the field. If you do not have access to run scheduled jobs on your web space then you could just run an update job in a commonly used script (ie, the sites login script). However I agree that having a redundant column saying they have no access is not best practice (but you might be sending them a reminder email). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/168873-timer/#findComment-891144 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.