php timestamp newbie question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkx
    Confirmed User
    • Nov 2003
    • 4001

    #1

    php timestamp newbie question

    ok i inserted a timestamp row and when i insert a new query manually from phpadmin it appears correctly. what command do i use for:

    $sqlquery = "INSERT INTO $table
    VALUES(
    '".mysql_insert_id()."','
    1','
    ???????????','
    ','
    ','
    ','



    ???????????',' is where the timestamp command should go
  • grumpy
    Too lazy to set a custom title
    • Jan 2002
    • 9870

    #2
    you dont put anything in the timestamp. It will update automaticly when you update the record. So you leave that field empty. ( doesnt matter what you put there, it wont be accepted. )
    Don't let greediness blur your vision | You gotta let some shit slide
    icq - 441-456-888

    Comment

    • Tempest
      Too lazy to set a custom title
      • May 2004
      • 10217

      #3
      Was that field defined as a TIMESTAMP field? If so, then setting it to NULL will load it with the current time. You CAN set it to a specific value and it also updates every time the row is updated.

      Comment

      • mkx
        Confirmed User
        • Nov 2003
        • 4001

        #4
        thats what i thought but i tried a test transaction and it showed up as "00000000000000"

        Comment

        • mkx
          Confirmed User
          • Nov 2003
          • 4001

          #5
          yes it was put as NULL, when I update something via phpmyadmin it is fine, but when i insert it using the code in the 1st post, it shows up as all 0's

          Comment

          • mkx
            Confirmed User
            • Nov 2003
            • 4001

            #6
            $sqlquery = "INSERT INTO $table
            VALUES(
            '".mysql_insert_id()."','
            1','
            ','
            ','
            ','
            ','

            the bold part shows the third row (timestamp)

            Comment

            • mkx
              Confirmed User
              • Nov 2003
              • 4001

              #7
              ok nevermind, i see that when you update the transaction it changes. my program updates it before I need the timestamp anyways. Thanks!

              Comment

              Working...