Jump to content

passwords as...


jimfog

Recommended Posts

It would be a bad idea to use username as a key if there is any chance of a user changing it.
Not really... I mean, even if you use it as a foreign key in another table, there's an "ON UPDATE" action you can define on the foreign key.
Every forum I've ever seen uses user numbers as the key to their member database. There must be a good reason for that.
Yes, though data integrity is not it. Space and efficiency on INSERTs and UPDATEs are.
Link to comment
Share on other sites

As a sidenote, I use PHPMyAdmin to handle the database. I have set the primary key the username-sth I wish to change now. The question is does anyone know how to unset that.Or do I have to delete the username field and recreate it without setting it as primary key?

Link to comment
Share on other sites

When using PHPMyAdmin, I think it's a matter of a checkbox next to the column(s) you wish to be the primary key. So, if you decide to change the primary key, you need to first create the appropriate column that will become a primary key, and then change the checkbox accordingly.In terms of SQL syntax, I think it's something like "ALTER TABLE `users` ADD CONSTRAINT PRIMARY_KEY (`new_primary_key_column`)".

Link to comment
Share on other sites

Thanks-I did it the way you proposed it..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...