SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2009
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    datetime.. not sure if this is server issue..

    i have a php file that inserts 'NOW()' into a DATETIME column in my table (with other data) and it always turns up as 0000-00-00 00:00:00. The other stuff is working fine, though.
    I'm running MAMP.. does it have the server time set properly? I know that could be an issue, but assume it would be ok.

    $qstring = "INSERT INTO tbl_members (member_id, member_lastname, member_date) VALUES (NULL, '".$lname."', 'NOW()')";

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,246
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    you are not inserting the current time, you are inserting a character string

    try taking the quotes off that you have around NOW()

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •