remember what months a users has paid
I have a website, with register and login ability.
Start of each month I issue new information that covers all one month, users can pay set fee to access this info on a monthly basis
Whats the best approach in mysql to remember what individual months a user has paid for?
Basically, if a user has paid for January and April, I want to check that users DB data and give them only information for January and April, not February and March
The tricky bit is, this would have to span over multiple years
If it was only one year it wouldnt be so bad, but I want to give them all the months info they have ever paid for
That might be:
January, February & November 2006
AND
March & April 2007
Cheers
kb posted this at 19:43 — 20th July 2007.
He has: 1,380 posts
Joined: Feb 2002
Use a date system? So "2007-01-01" would be all of January 2007, and "2015-12-01" would be December 2015... you would just ignore the day, and pay attention only to the month and year.
So... each time they pay, insert a new row with:
Field | Value
----------------
id => [autogenerated]
user => [user's id number]
period => [date for month paid]
amount => [amount paid]
paid_on => [date payment processed]
etc....
Get the picture?
That's how I would do it anyways...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.