SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Easy Question

  1. #1
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Easy Question

    I have a table with a field type as date. I have only used timestamp so I'm new to this. When I enter info into the DB it doesn't put anything into the date field. Timestamp automatically updates this and I have no idea how this works. Now if anyone could tell me how to get todays date into the field it would be great, thanks.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    INSERT into tablename set datefield = CURDATE(), someotherfield = someotherthing, someotherfield2 = someotherthing2;
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you have to use set? I have it so it does
    INSERT INTO TABLE_NAME (field, field1, field2) VALUES(value_field, value_field1, etc.....)

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats fine

    INSERT INTO TABLE_NAME (datefield, field1, field2) VALUES(CURDATE(), 'value_field1', 'etc.....')


    Notice the lack of quotes around CURDATE(), all the other ones need quotes except when using a function of MySQL like CURDATE()
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No quotes.... What a concept.... Thats all I needed to know. Thanks!


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
  •