sebastian_sabo Posted May 7, 2008 Share Posted May 7, 2008 I have an issue during the instalation of a database The message i get sounds like this: Error SQL query: CREATE TABLE categories( id int( 11 ) DEFAULT '0' NOT NULL AUTO_INCREMENT , parent_id int( 11 ) DEFAULT '1' NOT NULL , name varchar( 25 ) DEFAULT '' NOT NULL , description varchar( 255 ) DEFAULT '' NOT NULL , PRIMARY KEY ( id ) , KEY parent_id( parent_id ) , KEY name( name ) ); MySQL said: #1067 - Invalid default value for 'id' please help me to resolve this. Link to comment https://forums.phpfreaks.com/topic/104637-instalation-problems/ Share on other sites More sharing options...
fenway Posted May 8, 2008 Share Posted May 8, 2008 I think you have to put default after NULL/NOT NULL... Link to comment https://forums.phpfreaks.com/topic/104637-instalation-problems/#findComment-535862 Share on other sites More sharing options...
wildteen88 Posted May 8, 2008 Share Posted May 8, 2008 If you have fields which are set up as NOT NULL (meaning a value must be present in the field), they cannot have a default value, thus the error you are having. Only use DEFAULT when fields can have NULL values. Link to comment https://forums.phpfreaks.com/topic/104637-instalation-problems/#findComment-536080 Share on other sites More sharing options...
fenway Posted May 9, 2008 Share Posted May 9, 2008 If you have fields which are set up as NOT NULL (meaning a value must be present in the field), they cannot have a default value, thus the error you are having. I don't think so... I can' default an INT to 6 without the field being NULL-able. Link to comment https://forums.phpfreaks.com/topic/104637-instalation-problems/#findComment-536680 Share on other sites More sharing options...
mezise Posted May 12, 2008 Share Posted May 12, 2008 AUTO_INCREMENT field cannot have default value defined, because it is handled by MySQL engine. Link to comment https://forums.phpfreaks.com/topic/104637-instalation-problems/#findComment-539066 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.