SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    timestamp for new row created

    hi,
    how to check the timestamp for every new row created ?

  2. #2
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same query as before, only add DEFAULT CURRENT_TIMESTAMP
    example:
    ALTER TABLE `YOUR_TABLE` ADD `current_ts` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP

    Now it will update value on each new insert and on each update


Bookmarks

Posting Permissions

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