Hey,
I think my DB has very standard parts and I don't want to reinvent the wheel again so I wonder if there are some ready and widely used DB templates for what I need -
My database is all about customers, so I got a bunch of tables related to them.
Now what I'm trying to design is how I add ALL the users of my web application in the DB design.
I've got 4 types of users- Admin, manager, secretary and all the customers. They ALL need access to my application but each of them has different functions. For example the manager can see all the data about the customers, but each customer can see only his private data..
So this reminds me of the way forums work, but I don't know what a forum DB looks like..
Should I do it like this? :
tables:
tblCustomers: customerId, name, address, etc..
tblMembers: username, password, userTypeId. (in case it's a customer his customerId is the username, and other users will get a new username(.
tblUserType: typeId (d1(admin),2(customer),3(manager), 4(secretary()

OR

tblCustomers: customerId(as username),password, name, adress, etc..

tblMembers: username, password, usertypeId .(this table is for everyone besides the customers(
and no usertype table needed at all..

any links to helpful sites would be appreciated!

Recommended Answers

All 6 Replies

wow I feel like a child in a candy store!!! thank you!! gonna start digging to find something good there!!

that site is the great, but still doesn't answer my question..
it's more about the technical aspect of the access to my system and I'm still not sure how to deal with all the different user types..

Sounds like you're trying to design an access control system of sorts. Take a look at the data model for Access Control from the above site. It's not precisely what you want (it deals with "facilities" rather than "web pages/fields", but it should give you ideas about how to approach your situation.

I'm thinking that this ERD is the closest to what I need
http://www.databaseanswers.org/data_models/community_personalization/index.htm
but what I can't understand is how exactly php/html pages mix with the DB..
in the ERD there's a Page table..how do I connect my pages to that table from the page's side?
add a property for the page's Id in PHP or something?

I'm not sure how this works..
it's going to be the same PHP page, it contains personal info about 1 customer, so the data is changing depending on who access it, if customer John opens the page he sees only HIS data..so I'm still not sure how to make that connection.

Sorry, I can't help there...I'm not a PHP guy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.