Just use uniqid() by php. That will generate 4b3403665fea6 such kinds of number.
Oct 1, 2017
5
Level 4
How to generate a unique id based on own format?
I have a table as shown below
| id | id_p | doc_no |
|:-----------|------------:|:------------:|
| 1 | 1 | D11710001
| 2 | 2 | D21710001
| 3 | 3 | D31710001
| 4 | 4 | D41710001
| 5 | 5 | D51710001
| 6 | 1 | D11710002
I want to generate an unique id based on the id given. For example, when i have item to be stored in this table, it will generate an unique id based on the id of the table.
Note: The id in this table is a foreign key. The doc no can be modified by user into their own format manually. The doc no only will be generated automatically when user does not input a value to the doc no field.
The id format - P 'id' 'month' 'day' 001(auto increment)
How can i query this to generate unique id during storing data?
Please or to participate in this conversation.