Forum Moderators: open
CREATE TABLE phpbb_logos (id MEDIUMINT (8) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT, page INT (11) DEFAULT '0', image VARCHAR (255) DEFAULT '0', cat_id MEDIUMINT(8) UNSIGNED, PRIMARY KEY(id), UNIQUE(id), INDEX(id))
Got this error:
ErrorSQL-query :
CREATE TABLE phpbb_logos(
id MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT ,
page INT( 11 ) DEFAULT '0',
image VARCHAR( 255 ) DEFAULT '0',
cat_id MEDIUMINT( 8 ) UNSIGNED,
PRIMARY KEY ( id ) ,
UNIQUE (
id
),
INDEX ( id )
)MySQL said:
Invalid default value for 'id'
So how do I fix this? I've search online and these forums. Thanks.
CREATE TABLE phpbb_logos (id MEDIUMINT (8) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT, page INT (11) DEFAULT '0', image VARCHAR (255) DEFAULT '0', cat_id MEDIUMINT(8) UNSIGNED, PRIMARY KEY(id), UNIQUE(id), INDEX(id))
sol :
CREATE TABLE phpbb_logos (id MEDIUMINT (8) UNSIGNED NOT NULL AUTO_INCREMENT, page INT (11) DEFAULT '0', image VARCHAR (255) DEFAULT '0', cat_id MEDIUMINT(8) UNSIGNED, PRIMARY KEY(id), UNIQUE(id), INDEX(id))
or
CREATE TABLE phpbb_logos (id MEDIUMINT (8) UNSIGNED DEFAULT '0' NOT NULL , page INT (11) DEFAULT '0', image VARCHAR (255) DEFAULT '0', cat_id MEDIUMINT(8) UNSIGNED, PRIMARY KEY(id), UNIQUE(id), INDEX(id)) you can't say DEFAULT '0' and AUTO_INCREMENT. it should be AUTO_INCREMENT or DEFAULT '0'
[edited by: Discovery at 7:07 am (utc) on Sep. 4, 2007]