I am developing a membership system where user will pay for next 11 months from date joined on, my db structure as follows…
members table
| id | name | email | joined_on | expire_on |
+-------------+---------------+------------+------------+
| 1 | tester | test@test.com | 2012-01-09 | 2012-12-09 |
+----+--------+---------------+------------+------------+
I really need yours help with following…
I will run a cron job monthly/weekly, i would like to send payment reminder to users for monthly installment, what mysql query/php function should i use?
how to ensure if somebody didn’t miss any payment, or how can i mark payment? thanks…
Make another table called payments which has
–
idof payment–
useridof user–
datethey last paid–
lengthof paymentThen, to check when a user’s set to expire,
SELECT date+length as expy FROM payments WHERE userid = $userid ORDER BY date DESC LIMIT 1Store dates & lengths as unix time (number of seconds). If time > expy then their subscription is expired.