Have a table with the fields, ItemID, AdBeginDate, AdEndDate, ItemDetail,
AdDate (if needed)
Then just write a query to check what todays date is and what Ad/item
should be displayed depending on where todays date falls within the
AdBeginDate and AdEndDate. Just be sure to that add dates do not overlap.
This was you can map out however many ads you want into the future and
potentially you could have a user admin screen where they can change their
ad whenever they want and for however long they want. If it so happens
more than one ad will run in a week you will just have to change your logic
a little. This might not be the best approach if you know your only going
to have 5 items no more no less and for 1 week periods infinitely, however,
the approach I offer allows for flexibility and can put the ad maintenance
in the users hands.
CC
"Kennerly,
Rick H CIV" To: CF-Talk <[EMAIL PROTECTED]>
<RHKennerly cc:
@rroads.med.n Subject: Need 2 elegant Queries
avy.mil>
12/05/02
07:36 AM
Please
respond to
cf-talk
This is classic me. I've promised myself into a corner and demoed
something
hard coded without thinking about how to construct an elegant query to feed
it in production-mode via a database.
Query 1.
5 separate "ads" that run for a week each and rotate each Monday morning.
I
need to run ad 1 for a week, then ad 2 for a week, ....ad 5 for a week, and
then recycle to ad 1 for a week again. These are actually meal menus that
progress forward a week with each cycle.
Query 2.
I need to feed a scroller with "this week" information from a db with the
table columns itemdate, itemdetail.
I've thought of some kluges (particularly for number 2, which has resulted
in some truly epic, Byzantine queries), but I'd like something elegant.
Any
ideas?
Rick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm