F
F
fedot13252015-08-14 11:42:22
PHP
fedot1325, 2015-08-14 11:42:22

What's the best way to make a key-value for a single field in a db?

I can't find the right solution for my problem.
For example, a user can upload his clients, for this the database has the required id and name fields for each client from his database, but it should also be possible to use other data about clients, which for different users can be different and in different numbers .
For example, user A has a database of the form:
name | surname | phone | address
User B's database type:
name | patronymic | age | promo code | machine
In the future, the user should be able to use these values ​​as variables:
Hello $name! You are $yold, your car is $car.
I thought to make a separate variable field in the database and load data there in the form yold:23, car:bmw4, ...
To what extent is this decision correct? Are there other options?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel K, 2015-08-14
@fedot1325

Searching and choosing will be problematic.
I would just make a table with variables like
variables: user_id | key | value

S
Stanislav Makarov, 2015-08-14
@Nipheris

There is an option to use key-value storage for key-value data, since you have just such. Why would you try to look up the schema of the data if that schema is not expected? Take Mongu, since the fields about different clients are different.

B
beduin01, 2015-08-15
@beduin01

As a variant of ArangoDB. She also knows how to key-value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question