Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    125
    Thanks
    30
    Thanked 0 Times in 0 Posts

    "Default" column set to "CURRENT_TIMESTAMP", but not updating

    Hello.

    In phpMyAdmin, I have a row in a table with the following specs:

    * Field (name): updated
    * Type: Timestamp
    * Coallition: (empty)
    * Attributes: (empty)
    * Null: No
    * Default: CURRENT_TIMESTAMP
    * Extra: (empty)

    However, anytime I update a record, the "updated" field stays as the creation date of the record (not the current date). What could I be doing wrong here? What other information is needed for me to get help on this? Thanks!!!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    In MySQL the first timestamp-type column in a table will automatically be set as current_timestamp on update. Could it be you have another timestamp-type column in the table that is positioned before this column?

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    125
    Thanks
    30
    Thanked 0 Times in 0 Posts
    I actually figured out that I needed to change the "Attributes" coulmn to say "ON UPDATE CURRENT_TIMESTAMP", and then it works...

    Thanks, though!


  •  

    Posting Permissions

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