Jump to content

User hierarchy database structure


lemmin

Recommended Posts

I am working on setting up a user hierarchy system for a website and I am considering two different ways of doing it.

 

The first way is to have one users table and separate tables for each different user type. To change a user's access rights, his/her user id is put into one of those separate tables. The second way is to only have the one users table and have a user type field where an integer id represents the access rights that the user has.

 

The benefit of using the first way is that it would be possible to store extra data that relates to that user type in the separate tables. This could get rid of some null fields in the user table. The benefit of using the second way is that the query could simply check if the user's type is greater than (or less than) a certain value and include multiple user types for access rights.

 

Does anyone else see any other benefits or downfalls of these two structures? Or, does anyone know of a better way other than these two ways to create a user hierarchy? Which way would you do it?

 

Thanks for any input.

Link to comment
https://forums.phpfreaks.com/topic/191516-user-hierarchy-database-structure/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.