Jump to content
Larry Ullman's Book Forums

Phpmyadmin Won'T Save User_Id If Not Null


Recommended Posts

All the MySQL manuals that I own, or have borrowed, show a NOT NULL default for the user_id. In phpMyAdmin, if I enter NOT NULL for the user_id, an error message will prevent me from saving the table.  The error message reads #1067 Invalid default value for user_id. If I select None the table can be saved. The column user_id is auto_increment and the table works fine with None instead of NOT NULL. Would someone explain why this is so? . 

Link to comment
Share on other sites

NOT NULL means a row cannot have a null value. In your case user_id means that it updates itself as you have set auto increment. Meaning you can leave that field blank and the DB will do the rest.

 

To clarify the default options in phpmyadmin are None, As defined, NULL, current timestamp.

 

You are looking at two different areas. The NOT NULL field is a check box and not an available option under DEFAULT

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...