I am new to PHP. I am working on a project of Government Recruitment System. In that I want to provide system generated candidate login id to registerd candidates.
I want to generate the unique alpha numeric id like cdt1001 , cdt1002 , cdt1003..... so on. Somebody please help me to do that.
Thanks in advance.
Asked
Active
Viewed 342 times
-4
Kapil R
- 289
- 3
- 6
-
1Set your `id` in db to `auto-increment` and prefix it with `cdt` – Thamilhan May 31 '16 at 05:10
-
visit the below link http://stackoverflow.com/questions/1846202/php-how-to-generate-a-random-unique-alphanumeric-string – Reji kumar May 31 '16 at 05:12
1 Answers
1
If you want id's like cdt1001,cdt1002,cdt1003 then simply set id as cdt default and set the id field as primary key and set to auto increment.
or else if you want to generate random alphanumeric id's then u can use this : Rand function in php :
md5(uniqid(rand(), true))
User2403
- 317
- 1
- 5