timestamp - only when created mysql

Discussion in 'MySQL' started by billybrag, Aug 1, 2006.

  1. #1
    How can i add a timestamp that is only updated when the record is inserted, not when the record is updated.

    A kind of "date created" stamp
     
    billybrag, Aug 1, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Most of the osCommerce tables have 2 fields. One called date_added and one last_modified. So on INSERT you do a NOW() on date_added and NULL on last_modified and on UPDATE a NOW() on last_modified and not touching date_added. That way you have a nice record of when it was created and when it was last edited.
     
    T0PS3O, Aug 1, 2006 IP
  3. billybrag

    billybrag Peon

    Messages:
    324
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    can i do this from within phpmyadmin
     
    billybrag, Aug 1, 2006 IP