Hello,
I'm writing a PHP/MySQL web forum and although I have some PHP side code to ensure that a username isn't already taken it seems more correct to ensure the database cannot hold identical usernames. I want to use both a user-number and a user-name, each could be the key - and neither field shouldn't have identical information.
I know of the SQL "PRIMARY KEY (userID, username);" ...is this the correct way of doing it as I will never submit userID and username to get the full record's details - only one or the other.
I've heard about INDEX, is this what I should use?
Thanks for your time.
I'm writing a PHP/MySQL web forum and although I have some PHP side code to ensure that a username isn't already taken it seems more correct to ensure the database cannot hold identical usernames. I want to use both a user-number and a user-name, each could be the key - and neither field shouldn't have identical information.
I know of the SQL "PRIMARY KEY (userID, username);" ...is this the correct way of doing it as I will never submit userID and username to get the full record's details - only one or the other.
I've heard about INDEX, is this what I should use?
Thanks for your time.