heres what im trying todo... i have a db table setup:
[id][month][min][max][title][found][www][img]
id - primary key
month-2 digit representation of the events month
min - start day of the event
max - end day of the event
title - name of the event
found - association tied to event
www - event website
img - img data (if any)
an example recordset would be:
1-02-01-28-Event 1-Event 1 Foundation-http://www.event1.org-BINARY DATA
in this case, Event 1 runs the entire month of february
now, heres my struggle... i have some events that run just a single week and some that are just a single day... somehow i need to pull from the DB with some logic like this:
-based on todays month, find all records
-if there is ONE event that exactly matches todays date, return that record
-if there are MORE THAN ONE events that matches todays date, return ONE random selection of those events
-if there is ONE event in which todays date falls within a WEEK span event, return that record
-if there are MORE THAN ONE events in which todays date falls within a WEEK span event, return ONE random selection of those events
-if NONE of the above are true, pick one random event that span the ENTIRE month
NOW, what would be the best way todo this? Just build a large IF structure with multiple queries or IS there a more efficient way?
I dont really see that working... if i SELECT all where month = thismonth, how would i continue processing the results? (i havent played much with mysql recordsets other than just looping them out)
any/all feedback is welcome!