Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/168873-timer/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/168873-timer/#findComment-891005
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/168873-timer/#findComment-891124
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/168873-timer/#findComment-891144
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.