Hello class
I'm trying to wrap my head around a good, or better way of acheiving what I need to do.
Basically I'm making a serve up coupon book
The client will go in, specify what ever offer they are doing and select a "date range" of lets say 2 weeks, 3 months so fourth.
The idea is for when a user searches for a date, based on the date and the current date it will serve up a specific coupon.
For example, if today is March 25th, and you pick May 25th, you qualify for the 3 month interval coupon bu tnot the 2 week one.
So I need a way to store and compare times in mysql in such a way that I can pull qualifying coupons based on the current and user inputed time.
My idea of far is to store a int in the timeframe specified in seconds , 2 weeks = 60 60 24 * 14 = 1209600
And subtract curdate - user date and compare the results to the stored field in the database.
So I ask if anyone has a better idea of how to work this in mysql, i am still building and can pretty much change any structure if need be.