Jump to content

date based data changes?


mrpatrick

Recommended Posts

Im building a site to list concerts and events in an area.

 

there are three states for an event, upcoming, happening today, or you missed it

 

when the user submits the upcoming show, they insert the date of the show.

 

when its the day of the show, i need that status entry to automatically update to "happening today" or the second state, and then the next day self update to the final state.

 

i figure ill have to use cron to do this, or is there a way to run a script at the beginning of each day that will manage this?

Link to comment
https://forums.phpfreaks.com/topic/77417-date-based-data-changes/
Share on other sites

i dont think you need the self update

all you need it to compare the given date to the date today

i think datediff() is all you need

datediff(givendate, now())  now if the result is greater than one then its upcoming

if ==1 happening else you missed it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.