- 1). Open your MySQL table code and locate the table creation portion:
CREATE TABLE products (
ID MEDIUMINT NOT NULL,
UNAME CHAR(20) DEFAULT '' NOT NULL,
PRIMARY KEY(ID)
); - 2). Type "AUTO_INCREMENT" in the primary key (ID) definition. Modify this code as needed to fit your data:
CREATE TABLE products (
ID MEDIUMINT NOT NULL AUTO_INCREMENT,
UNAME CHAR(20) DEFAULT '' NOT NULL,
PRIMARY KEY(ID)
); - 3). Save the table modifications. The table "ID" field automatically increments.
previous post
next post