-1

I have users less then million. I use MySQL and table creates auto increment from 100000 (6 digits). If any problem if i use user id as account number for small web application. What is the best way in practice?

Newmaster
  • 57
  • 6

2 Answers2

1

Fairly unspecified what an account number exactly means. In general, you can use that but in my opinion, the user-id is a technical information which should NOT get outside of the system to the customer (for security reasons). I suggest to create a GUID or any other generated (unpredictable)id for each user and then use that as account number to give "outside". With this approach, no user can "predict" the ID of another user.

Roemer
  • 2,012
  • 1
  • 24
  • 26
  • GUIDs might be a little long to provide to users, but I agree that exposing internal id values is to be avoided when possible. – Uueerdo May 06 '15 at 16:19
1

Generally, I would decouple business logic from application logic even if the overlap is evident. The way key generation happens in databases could leave gaps and/or your app may not produce keys at the time needed. A simple key generator (synchronized maybe) maybe better. That said, here is more in this dialog for you to ponder upon.

Community
  • 1
  • 1
mohsenmadi
  • 2,277
  • 1
  • 23
  • 34