Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441

    timestamp alternative [mysql/php]

    I need to store threads with a post time, and a last post time. Timestamp in MySQL did what I needed, but whenever I update a row, it updates both fields.

    What would be a suitable alternative?

  2. #2
    Join Date
    Oct 2004
    Location
    Brisbane, Australia
    Posts
    259
    Please post the SQL query that you used to update the fields.

  3. #3
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441
    Code:
    UPDATE `threads` SET `lastpost`=null WHERE (`id`="'.$parent.'");
    Also, in the first field using timestamp the default is NULL, and in the other, the default is 00000000000000.

  4. #4
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    TIMESTAMP is auto-updating. You need the DATETIME type.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  5. #5
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441
    Yeah. I just realized that if I switched the order of the fields with `timestamp` it would work correctly.. apparently only the first one updates.

Posting Permissions

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