View Single Post
Old 11-14-2022, 08:25 PM  
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
Display SQL record from today and past 30 days?

I have this code, which lets me pull records from the 'created' column for todays date & time:

Quote:
SELECT * FROM table WHERE created >= CURRENT_TIMESTAMP;
What I'd like to do is have it pull records from the last 30 +/- days AND todays date, could anyone point me in the right direction as to how to make this happen?

Just to complicate it a little, Id like it to pull based on the month, so whether a recipe was added last year, 10 years ago, etc it'll still display the data as described below.

Basically, I'm wanting a pseudo page on my recipe site that gives visitors a list of 30 recipes for breakfast, lunch and dinner (that are recent additions) which will change every day, cycling through the last 90 recipe additions (per category)s, sort of like how the old POTD pages used to work.

TIA for any help.
__________________
SOMETHING EXTREME IS COMING SOON!
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote