Y
Y
Yura_Mart2018-03-18 06:18:47
PHP
Yura_Mart, 2018-03-18 06:18:47

How to implement a dynamic database (MySQL)?

Guys, tell me who faced this.
The bottom line is, there is an example, it has 5 forms (1 question, 4 answers) for sending data by the POST method to the server in pre-prepared cells in the database.
And how to dynamically add cells to the database if necessary?
Suppose a person needs not 5, but 6 forms? Then he will add 1 extra in the frontend (with the help of JS). the form and how to make automatic adding of a cell in a DB?
Ps And how then to display everything that is in the cells in the template, if we do not know in advance what will be there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chromimon, 2018-03-18
@Yura_Mart

Or JSON (or the like) to store.
That is one field.
But it has nested fields in JSON / XML - which is convenient.
This works fine as long as you don't need to search through form fields.
Another option - it works much slower, but idiomatically true for relational DBMS, to which MySQL also belongs.
It is done something like this:
1. Table FieldTypes
ID Name
2. Table Requests
ID Somedata
3. Table Fields
IDType IDRequest Value
And the link will be such
Request.ID = Fields.IDRequest and FieldType.ID = Fields.IDType

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question