SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Keeping a date field null after doing a mySQL update

    I have a field on form that stores a date. When I pull up one of my users, normally this date field is empty. But as soon as I click the form button's save button, and an update is made to the users table, that date field then becomes populated with '0000-00-00 00:00:00'. What do I need to do to my existing PHP code so that when I do an update, it won't put those zeros into the database if the field is left blank on the form? I still want the ability to modify a valid date if there is one in the form.

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SitePoint Member
    Join Date
    Dec 2004
    Location
    laval
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you simply not set the field as null on the update "UPDATE tablename SET dateinserted = NULL"


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
  •