View Full Version : customer code

06-19-2006, 11:04 PM
I am probably thinking about this too much (as usual), but lets say I create database to hold client information (fname, lname, street, city, state, zipcode, phone, email) and I want a customer code to enter automatically each time I enter a client and increment off the last number (ie John Doe was entered and assigned customer code 0001 and I enter John Smith and I want it to automatically make that 0002). That would be the primary key and unique in the database if I am not mistaken, but what PHP is necessary to do this part of it. I already have the form, php, etc... for the rest of the data entry.



06-20-2006, 12:27 AM
This is simple sql. Just set the ID field as auto_increment, then don't insert a value into it manually, and it will auto give you numbers.