View Full Version : Help with User ID
06-16-2006, 03:29 PM
I have a form where users can register. When they register, i would like to generate a user ID for them.
what's the best way to do this?
I thought that maybe I can create an ID field in the DB and have that be their user ID as it auto-increments? The thing is I don't know how to set the "minimum value" of this ID to be 8 digits.
06-16-2006, 03:37 PM
Normally it's better to let the user choose their user id and password. You can still require a certain format or minimum length for the user id and password and then you can just validate it when they submit it.
06-16-2006, 03:39 PM
So in my DB, what would be the primary key for the users in my DB? Would it be the user ID they use?
I figure that if I creat the user ID for them, I can sort things and organize things better in the DB.
06-16-2006, 04:18 PM
You could use the userid as the primary key or you could create a unique account number for every user and use that as the primary key and just associate the userid with that account number. As for sorting and organizing the data in the database you would only need to do something like that if you were going to generate a report with the user logins. The data in a database is generally not sorted and organized. When you query the database you can pull the data and sort it for whatever you are going to use it for. But in the case of logins I can't really see a need for that. Also if the database is well designed the login type data would be in a seperate table from all the other data. So if you use an account number associated with a user login to retrieve data on someone you would just need to do a lookup on the userid to retrieve the account number and once you have that you can pull of data from any of the other tables for that account.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.