Hide after date/time past
I'm making an event script and i have done the add and edit page for that but now i want to add a function to make an event disappear when it's final date is reached. For ex:
I have this fields in the db:
EvDateAdd is the current date/how, the date/hour when the event is recorded in the database and i'm using NOW() in the sql query to get that.
Now, i need a way to add the date at EvDateExpiry for the expiration date.This (i suppose)can be made by a calendar but the problem on it (except that i don't know how to integrate a calendar in it) cannot be add the time too in the same field. If i will do it with a calendar script, i should add a new field in the db EvHourExpiry, i suppose...ore you can give me any other idea.
...Ok...i suppose that i have made this changes in the admin area...now, how to make the event disappear when the date and time combination is reached?
P.S. EvActive is a check button that have 2 values: Yes(event is active and appear in the page) and NO (event is inactive and cannot be seen on the user page)
Thank you very much and hope that you will help me!
This works for me. Different variable names.
I have the one hour date add because the server is in a different time zone.
$query = "SELECT ID, Title, Category, Priority, Sticky, Author, More, Introtext,UCASE( DATE_FORMAT(Publish_Up,'%b %d, %Y %l:%i %p'))AS publishDate, Publish_Dwn, URLS
WHERE Category = 1 AND Publish_Up <= DATE_ADD(NOW(),INTERVAL 1 HOUR) AND (Publish_Dwn > DATE_ADD(NOW(),INTERVAL 1 HOUR) OR Sticky=1) AND Priority > 0 ORDER BY sticky DESC, priority ASC, id DESC LIMIT ".$show;
For me publish_ dwn is the beginning of the next month. This can be calculated pretty easily in php or even in the MySQL query. For me every article in November expires on the first of December... after that they can be accessed from archives.
Last edited by Dasher; 11-06-2010 at 10:45 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)