#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0

    INSERT and Default Values of fields


    Hello folks,

    I am new to the forums so please bare with me. I have an application written in PHP/MySQL. It worked fine until I upgraded from MySQL 5 to 5.6. The only problem seems to be the INSERTs. Previously I didn't need to specify default values on columns, I could do an insert such as:

    INSERT INTO studentinfo (first_name,last_name,middle_initial,address,postal_code,home_phone,mobile_phone,home_email) VALUES ('Bob','Campbell','B','22 High Street','90210', 'xxx-xxxx','xxx-xxxx','bob@bob.com');

    There are other columns being omitted in my INSERT and this worked fine before - these columns were left void and only had data entered after the fact with an UPDATE.

    With my new install, all of the sudden MySQL complains that these other columns do not have default values. Will I need to go through each table and add default values for all of these columns? Or am I just missing something simple? I hope I was clear enough about my issue, again, my first time on the forums. Thanks very much in advance for any help offered.

    -D
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0
    I've found the issue I believe. I changed the STRICT MODE in my.ini (windows) and all seems well. For anyone else who may come across this issue.

    Thanks anyways folks !

    -D
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    glad you were able to find a workaround

    by the way...

    bear with me = have patience
    bare with me = let's get undressed together

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0
    Oh, I know. I just like to troubleshoot MySQL issues in the nude.

    lawl

    Thanks again.

    -D

IMN logo majestic logo threadwatch logo seochat tools logo