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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Quick MySQL date question

  • 08-11-2006 2: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, Registered Users 2 Posts: 2,170 ✭✭✭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