View Single Post
Old 01-05-2008, 06:32 AM   #17 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Auto increment adds one to the value on every row inserted, I always stick 'NULL' in there. For instance, you have these rows

ID Name
1 - Lazy
2 - Foo
3 - Bar

All you have to tell the database to assign is the name, it will take care of the ID itself.

If you delete 3 and insert another row, it will look like this
ID Name
1 - Lazy
2 - Foo
4 - Monkey

It will always add one, not from the row count or the last value, it keeps a value elsewhere. All your primary keys should be auto_increment unless you have a good reason otherwise (I've yet to find one)
__________________

Village Idiot is offline  
Reply With Quote