#1
  1. No Profile Picture
    TheDuke
    Guest
    Devshed Newbie (0 - 499 posts)
    I have created a table with the following column:
    datetime TIMESTAMP;

    this would mean then whenever i insert or update a row in this table the
    datetime field automatically gets the value of the current date/time
    this is correct right ?

    i insert data to the database with a form and as the TIMESTAMP value I
    insert NULL

    but whenever i try to pull the data back out with fethrow or fetcharry and
    display it all i get is 14 zero's... like this: 00000000000000

    does anybody got an idea what is going on or what i'm doing wrong ?
    if requested i can place the code here if that might be helpful...
    i'm running the windows versions of php3/mysql on PWS (for testing purposes)
    i'm sort of new to all this so a clear response is appreciated...


  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    I've found this particular feature of mysql very unreliable (Glad to hear I'm not the only one.)

    I've taken to using a unix timestamp from PHP and inserting that manually.

    Rod
  4. #3
  5. No Profile Picture
    zoordaan
    Guest
    Devshed Newbie (0 - 499 posts)
    I could be wrong- I think if you set the default value of the timestamp field to null then it's automatically set to 0, then you have to change the value from the default if you want it to be different.

    When I insert/update I set the value of timestamp field to NOW().
    i.e. UPDATE table SET timestamp=NOW()

    You can check out the mysql manuals on devshed to learn more about timestamp.
  6. #4
  7. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    You are. Wrong, that is

    Setting a timestamp field to null is "supposed" to set it to current time. It is also supposed to update if ANY changes are made to the record, whether or not the timestamp field is specifically accessed or not.

    Rod K

Similar Threads

  1. DATETIME and TIMESTAMP
    By herou in forum MySQL Help
    Replies: 3
    Last Post: February 9th, 2004, 12:22 PM
  2. PHP data retrieval question with MySQL
    By gursharn in forum PHP Development
    Replies: 7
    Last Post: December 31st, 2003, 10:43 AM
  3. timestamp( mktime )
    By xlordt in forum PHP Development
    Replies: 7
    Last Post: December 29th, 2003, 08:24 PM
  4. Javascript question mark question?
    By tajmiester in forum JavaScript Development
    Replies: 3
    Last Post: November 30th, 2003, 06:36 PM
  5. Radio Buttons
    By Ulysses Freeman in forum HTML Programming
    Replies: 4
    Last Post: November 15th, 2003, 10:57 PM

IMN logo majestic logo threadwatch logo seochat tools logo