How to create an automatic customer id? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to create an automatic customer id?

For example customer id : PLG0001 If you add a new customer, the new customer will get the customer ID PLG0002 How do I set it in the database? So it's only the numbers that increase So when filling out the form, the id does not appear, but when it has been saved, the customer id will appear in the customer data table along with other data too I found this code on google https://code.sololearn.com/cLaVJwFL5B2K/?ref=app I don't know where the code should be put, should the code be written on the customer data form? But I don't understand how to change it to PLG0001 if add customer then new customer will get id PLG0002 ?

23rd Jun 2023, 3:14 AM
Nasywa
2 Answers
+ 3
Nasywa Customer id should be autoincrement in database and it is only possible when you use Int datatype.
23rd Jun 2023, 11:09 AM
A͢J
A͢J - avatar