Auto incrementing key in a table.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Auto incrementing key in a table.

Post by mattyboi »

How do you create a key that auto increments in a table everytime a new record is added using phpMyAdmin?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Set the field to auto_increment. :?
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Post by mattyboi »

yeah i did that, but for some reason it is still not working. what do i set the field type as, and the defualt value?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

field type is an INT base, the size only matters in how many records you wish to support without reordering. INT(10) UNSIGNED is the minimum suggested by many. default value doesn't matter. It must be set to PRIMARY.
Post Reply