www.webdeveloper.com
Results 1 to 2 of 2

Thread: Hide after date/time past

  1. #1
    Join Date
    Aug 2010
    Posts
    20

    Hide after date/time past

    Hello there!
    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:

    - EvID
    - EvName
    - EvImg
    - EvTxt
    - EvDateAdd
    - EvDateExpiry
    - EvAuthor
    - EvActive

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    This works for me. Different variable names.

    PHP Code:
    $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 
    FROM content 
    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
    I have the one hour date add because the server is in a different time zone.

    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 11:45 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles