how to know whether today's date is still valid for the weekly promotion??
hi, got a question here. hope to get some help from you guys.
how am i going to select a promotion by weekly?
i have a promotion where admin can key in the start date of tat promotion and it will be a weekly promotion.
when come to display, i donot know how to select. how to calculate, whether the start date tat admin enters is still valid for the weekly promotion or not...
Mark Hensler posted this at 05:25 — 19th November 2002.
He has: 4,048 posts
Joined: Aug 2000
I'm a bit lost.
I'm guessing that you want to select a start date. Calculate the duration of a promotion (start date + 7 days). I'm not sure what you want to check for validity.
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 06:29 — 19th November 2002.
They have: 164 posts
Joined: Nov 2001
yes..in my database i only store the start date...but how am i going to select out the promotion if the date is still within the 7 days??
zollet posted this at 06:43 — 19th November 2002.
He has: 1,016 posts
Joined: May 2002
It's not that hard with PHP, are you using PHP?
joyce posted this at 06:50 — 19th November 2002.
They have: 164 posts
Joined: Nov 2001
yes...how to do tat?
Mark Hensler posted this at 07:20 — 19th November 2002.
He has: 4,048 posts
Joined: Aug 2000
don't use PHP... too much coding... throw the extra work at the SQL server...
SELECT * FROM table_name WHERE TO_DAYS(start_date) >= TO_DAYS(NOW())-7
or
SELECT * FROM table_name WHERE ADDDATE(NOW(), INTERVAL -7 DAY) >= start_date
I'm assuming that start_date is a date, datetime, or timestamp data type field.
Mark Hensler
If there is no answer on Google, then there is no question.
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.