Log in

View Full Version : help with phpmyadmin making an sql



keyboard
06-15-2011, 11:54 PM
Hi everyone,
I'm trying to make a new database using phpmyadmin and the sql query window.
CREATE TABLE tblUsers (
fldId INT NOT NULL AUTO_INCREMENT,
fldUsername VARCHAR(40) NOT NULL,
fldPassword VARCHAR(40) NOT NULL
);

does anyone know why this code won't work.
Thanks for any help

traq
06-16-2011, 01:30 AM
phpmyadmin gives this error:

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
so, add the key to your auto-increment column:

CREATE TABLE tblUsers (
fldId INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
fldUsername VARCHAR(40) NOT NULL,
fldPassword VARCHAR(40) NOT NULL
);