View Full Version : Auto generate ID number for new entries in a MySQL DB

02-27-2005, 10:23 PM
I'm creating a script that adds certain information into a database, the table in the DB has a field for "ID" but I don't want the user to enter this info, I want it to be generated automtically and inserted into the DB. How can I go about doing this.

ps. This is my first PHP script, please don't assume I know more than an beginner

02-27-2005, 10:59 PM
You set the ID field as PRIMARY_KEY and use auto_increment. You can do it with phpmyadmin.

02-27-2005, 11:44 PM
Cheers, thanks for that:D