1

Thanks for at least looking at this question.

I run a small website which allows people to sign up for a premium account. I control this via a group in an SQL database. So if group_id is 5 is premium. Currently I update this all manually but I'd like to have a php script that connects to SQL where a date is stored for when the account expires which'll just change the group_id back to 4.

If anyone can help I'd really appreciate it, or if you need any more information please ask :).

6 Answers 6

1

This is the kind of thing a cron job is perfect for. Write a php script that does the changing of the group_id based on the date, and set up a cron job to run the script at regular intervals.

Sign up to request clarification or add additional context in comments.

Comments

0

Using cronjobs, check this tutorial: http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

Just check if the account is expired, run the cron 2 times a day ...

Comments

0

Update table set group_id = 4 where date('xxxxxxxx') < [what ever date you enter];

Comments

0

CRON? Or if that isn't available then you can create some logic based on the logins to your page (check the expired account on every login).

Comments

0

You can run a PHP script as a cron job if you're using linux or as a scheduled task if you're using Windows.

Comments

0

Why can't you just check the expiration time in your query instead of group, like everyone else do?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.