Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

php exclusion by date??

  • 02-02-2006 02: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, Registered Users 2 Posts: 68,173 ✭✭✭✭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, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Hmmm

    /notes down


Advertisement