How to insert into database with setting the default values in phpmyadmin

18,266

Check your code is like this

when you creating database you should apply this option as well.image marked in red

And in your code assign Your value3=NULL.

Then add the above function as same.

INSERT INTO table_name (column1,column2,column3,...)
    VALUES (value1,value2,value3,...);
Share:
18,266
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    I have two phpmyadmin both are version 4.2.7 and PHPversion is PHP Version 5.4.24 one of phpmyadmin is allowing null values and another not accepting the null values

    Phpmyadmin - 1

    INSERT INTO table_name (column1,column2,column3,...)
    VALUES (value1,value2,value3,...);
    

    Phpmyadmin - 2

    On the second table i didn't give the values for column3 its error like

    I got error:

    General error: 1364 Field 'column3' doesn't have a default value.

    Even though i didn't set the null for phpmyadmin-1 but its working fine. How can i solve this ? Any suggestion ?

    INSERT INTO table_name (column1,column2,...)
    VALUES (value1,value2,...);
    
  • Admin
    Admin about 9 years
    yes i got it but i dont want to define for all fields how can i fix for the whole db ? and read my question please
  • Admin
    Admin about 9 years
    I have given the same for phpmyadmin -1 its working fine without assigning the null values
  • Abdulla Nilam
    Abdulla Nilam about 9 years
    INSERT INTO table_name SET column1 = 'value1', column2= 'value2'. try this out
  • Admin
    Admin about 9 years
    without nullable it was inserting in phpmadmin-1 got it ?
  • Admin
    Admin about 9 years
    your answer not helped :(