Question

I created a field in my table and set it as the index but I can't get it to increase on it s own when a new item is added. How do I do make it do this through PHPMyAdmin?

Was it helpful?

Solution

Select the A_I check box when creating/editing a column.

OTHER TIPS

The Answer of Brian Fisher is correct, but there is another way if you want to try it in code. Just Click on the database, go to SQL and type for example the following code:

CREATE TABLE Player (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
username CHAR(30) NOT NULL,
PRIMARY KEY (id)
)

Explanation:
MEDIUMINT:
INT with minimum Value -8388608 and maxmimum Value 8388607
or minimum Value 0 and maxmimum Value 16777215

NOT NULL (Two operators in one):
This value may never be empty

AUTO_INCREMENT:
What you where looking for
The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top