PDA

View Full Version : Error in table creation...


okami
3-29-06, 09:19 AM
I'm getting:
PRIMARY and INDEX keys should not both be set for column `id`

After using the following:

CREATE TABLE badwords (
id int(11) NOT NULL auto_increment,
words text NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id),
KEY id_2 (id)
) TYPE=MyISAM;

INSERT INTO badwords VALUES (1, 'tons,of,bad,words,here,so,i,left,them,out');

# --------------------------------------------

CREATE TABLE shout (
id int(11) NOT NULL auto_increment,
ip varchar(20) NOT NULL default '',
link varchar(30) NOT NULL default '',
name_id varchar(30) NOT NULL default '',
text text NOT NULL,
time varchar(40) NOT NULL default '',
PRIMARY KEY (id),
KEY id (id)
) TYPE=MyISAM;

Looking around phpmyadmin, but not real sure on which needs to be changed to what.

Any help would be greatly appreciated. :)

mitchind
3-29-06, 10:50 AM
Get rid of UNIQUE KEY and KEY definitions in first table, KEY in second table

You've already defined them as PRIMARY KEY - which means they're going to have to be unique and indexed.