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.........
ipradip
0
Light Poster
Recommended Answers
Jump to Postsample
select concat('A',lpad(MAX(substr('A0001',2))+1,4,'0')) new_numberfrom 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
Jump to PostYou don't give a lot away do you?
You want to generate (as opposed to assign) 'A0001' as user id - so presumably you will also be generating other ids of, what, A0002, A0003 and so on? or B0001, C0001?
Either way, what you need to do is …
All 7 Replies
urtrivedi
276
Nearly a Posting Virtuoso
tiggsy
4
Junior Poster
ipradip
0
Light Poster
urtrivedi
276
Nearly a Posting Virtuoso
tiggsy
4
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
ipradip
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.