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

Quick MySQL date question

Options
  • 08-11-2006 3:34pm
    #1
    Closed Accounts Posts: 2,175 ✭✭✭


    I'm using phpmyadmin.

    I have an 'expires' field in one of my tables. So I'd like to set the default to be something like current date + 4 months, or thereabouts. Is there a way to do it in phpmyadmin?

    Thanks.


Comments

  • Closed Accounts Posts: 119 ✭✭frodo_dcu


    unfortunatly as far as i know you can't set the default value in mysql to be function so you would have to do this in your php script when add the row


  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    I figured as much tbh.

    I just wonder if there is an in-built one of somesort somewhere in phpmyadmin.

    Thanks frodo.
    Can anyone confirm this?


  • Registered Users Posts: 2,157 ✭✭✭Serbian


    I don't think it can be done by default alright, but you can make it pretty easy by doing it in your SQL statement when adding a row:
    INSERT INTO table (some_field, expires) VALUES ('some_field_value', DATE_ADD(NOW(), INTERVAL 4 MONTH))
    


Advertisement