I have a drop list which the values are retrieve from the database
id name
1 meeting
2 conference
3 workshop
I also included a textbox field where user can add drop down values. My question is for example when the user adds a value "seminar" in the database, its id must be 4 which goes like this.
4 seminar
Any idea on how it will be? Sample code is much appreciated.
Thanks
increment drop down list category id
Moderator: General Moderators
-
greedyisg00d
- Forum Commoner
- Posts: 42
- Joined: Thu Feb 12, 2009 2:48 am
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: increment drop down list category id
Just set the ID column in your database to auto increment and primary key, and it will do this automatically when you add a new row.
Re: increment drop down list category id
adding to what matt said, add an id 0. the autoincrement will set it to the highest value automatically.