Q
Q
Quber2015-01-08 21:51:59
PHP
Quber, 2015-01-08 21:51:59

How to organize the storage of users in a database with different fields?

There is a table with users. Half of the users will have one field, others will have others (ala employers and job seekers). In fact, two different groups of users, each have their own individual fields to fill out.
I found just such a scheme
8fdb462ab85879436dd31e468069bbb6.png
But it is for goods. It is clear that it can be adapted for users. But is it logical to do so? In this scheme, it is calculated for a mass of different products and options. I plan to create only two types of users with their own fields.
I wonder how it is organized, for example, on the site "freelance" and others.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Subbota, 2015-01-08
@Quber

For example: create a table user (id, username, userpass ... foreignkey) and two tables such as candidates and employer with corresponding (different) fields. Using crosstable + foreignkeys we create dependencies between users and groups.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question