hello,

our site have 1000 users.here i have to give unique numbers from '000' to '999' to each user.
now i am adding from starting '000'. how can i give unique numbers to users when adding and updating users?

Thanks

Make it an auto-increment unsigned integer. You can add the zeroes in PHP.

Member Avatar
diafol

I agree, storing 000 as a PK doesn't really make sense as a rule. You can use str_pad() to give leading zeroes if you really have to. I'd advise NOT using these leading zeroes in any part of your DB tables. It should be just a cosmetic thing for screen output. Or do you have a different use in mind?