SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2002
    0 Post(s)
    0 Thread(s)

    ||| CURDATE() 0000-00-00 00:00:00 woes :'( |||

    Hi All,

    First I should point out that I have read the other posts on this issue and understand the problem with enclosing the curdate() command in quotes and therefore making it text and as a result this throws the 0000-00-00 00:00:00 value into the db.........

    The problem I have is that I simply can't get mySQL to recognise the curdate() command and all my inserts are the dreaded zero's

    If i run this in mySQL it returns the date:

    mysql> SELECT CURTIME();

    However........if I try to run this

    mysql> ALTER TABLE `album` CHANGE `date_added` `date_added` DATETIME DEFAULT curdate() NOT NULL;

    I get the following error:

    ERROR 1064: You have an error in your SQL syntax near 'curdate()' at line 1

    If I enclose the curdate() command in quotes then the alter table SQL runs find but obviously inputs text into the date field resulting in 0000-00-00 00:00:00

    Any pointer/help really appreciated

    TIA - JaYsuN

    P.S. I have a Windows 2000 setup (sorry!) and mySQL v2.32.52-nt

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2002
    0 Post(s)
    0 Thread(s)

    CURDATE is use differently

    CURDATE() is use in the SQL command. I never like the default value. Put it as string type in your query from PHP .VB/ASP.

    INSERT INTO approval_process (PR_ID, Approval_Date, Approval_ID, Approval_Sequence, IsApprove, Comment) VALUES ('232', CURDATE(), '232', 23, 23, '23')


Posting Permissions

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