i want to generate A0001 as user id in php. i tried a lot for this but i can't did that so anybody here to help me.........
Jump to Post
select concat('A',lpad(MAX(substr('A0001',2))+1,4,'0')) new_number
from table here pkcolname is your primary key of table with first is letter and rest 4 are numbers.
select concat('A',lpad(MAX(substr(pkcolname,2))+1,4,'0')) new_number FROM TABLENAME
All 7 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.