SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setting datetime default as now() ?

    title has a typo: it should read datetime, not datetimestamp. vB won't update the title

    is it possible to set datetimestamp default as now() ?

    when trying to do
    Code:
    ALTER TABLE `news` CHANGE `date_post` `date_post` DATETIME DEFAULT "NOW()" NOT NULL
    then doing
    Code:
    INSERT INTO news SET
    rel_uid		= "1",
    subject		= "subject here",
    message		= "message here",
    forum_link	= "link here"
    results in
    Last edited by GeekSupport; Sep 21, 2003 at 02:26.

  2. #2
    SitePoint Enthusiast CRYSTL's Avatar
    Join Date
    Sep 2003
    Location
    Kazakhstan
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try NOW() without quotes.

    And try setting it to NULL instead of NOT NULL.

  3. #3
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dang, other folks are up at this time too

    Code:
    You have an error in your SQL syntax.  Check the manual that corresponds to your 
    MySQL server version for the right syntax to use near 'NOW() NULL' at line 1
    putting quotes around NOW() fixed the syntax problem, but when performing the same query (above), it still shows all 0's for the date. i changed date_updated to timestamp but date_post (i would think) needs to remain as datetime to keep the original posting date

    also, if i set it to null, wouldn't that make 0's default if nothing was entered?


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
  •