Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

php exclusion by date??

Options
  • 02-02-2006 3:47pm
    #1
    Closed Accounts Posts: 8,866 ✭✭✭


    Can anyone help me, i have a php page listing items from a mysql database which all have a closing date, and i want any items that have gone past their closing date to be excluded from the list. This is achieved using the WHERE clause in php so i'll have something like

    "....WHERE sit_closing_date<"

    anybody know how i can do this?

    cheers


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    It depends on how the dates are stored in a database.

    If the dates are stored as INT (like I tend to do), then

    "...WHERE sit_closing_date > ".mktime()."....";

    Should do. If dates are stored as DATETIME or another date stamp, then

    "...WHERE sit_closing_date > NOW()"

    Should work in theory.


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Yeah their stored as DATE, i got this error when i tried your suggestion. Might try changing the date stamp to int.

    Query failed:Unknown column 'NOW' in 'where clause'


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Wait, scratch that, i got it! I didn't put the ()'s after NOW when i tried that solution! :rolleyes:

    Cheers seamus!


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Hmmm

    /notes down


Advertisement