datetime field MSSQL and PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gradeA
    New Member
    • Mar 2007
    • 2

    datetime field MSSQL and PHP

    Hi,

    I am having trouble inserting data into a datetime field in MSSQL. Here is the script I am trying to execute:
    [php]
    $now = date('d/m/Y g:i:s A');

    mssql_query("IN SERT INTO clients (created,modifi ed,firstname,la stname,address, address2,addres snotes,city,pro vince,countryII D,postalcode,ho mephone,passwor d,email) VALUES
    ('$now','$now', '$firstName','$ lastName','$add ressSubmit','$a ddress2','$addr essnotes','$cit y','$province', '$countryIID',' $postalcode','$ homephone','$pa ssword','$email Address')");
    [/php]
    Yet, when i look into the database, the created and modified fields (which are datetime format) show 'NULL', and if I change $now='', the created and modified fields show 01/01/1900

    Any help would be appreciated. Thanks.
    Last edited by ronverdonk; Mar 25 '07, 12:08 PM. Reason: enclose code within tags
  • gradeA
    New Member
    • Mar 2007
    • 2

    #2
    oops, had the month/day places mixed up, all good nwo :D

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Welcome to TSDN!

      Good you found it yourself.

      Ronald :cool:

      Comment

      Working...