Kapil R Kapil R - 1 year ago 62
PHP Question

How to generate a unique alpha numeric login id using PHP and MYSQL

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

..... so on. Somebody please help me to do that.
Thanks in advance.

Answer Source

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))