There is a web application in PHP in which the user can create forms himself using a constructor.

With the preservation of information about forms (i.e., information about inputs, selections, and other elements that the form contains), there were no problems. There are two signs - one stores the form, the other form elements.

But there is another problem - how to store data stored using these forms? All this data in one table?

  • one
    And what is a "form", is there a concept of "document" in the system or something like that (if there is, then in theory one form apparently serves no more than one document, but the document can be edited in several forms). In short, if there is a document, then under it you can create a table with columns of the required types. At least the subsequent work with the data will be much easier. Issuing output forms, collecting some sums is clearly easier on a normal relational table than on a form-field-value table - Mike
  • The system has the concept of a module. Almost all modules contain a form for adding a record (the usual form in a modal window - inputs, selects, date selection, etc.), editing it and displaying records in a table. "In short, if there is a document, then under it you can create a table with columns of the required types." Those. dynamically create tables and columns in it? - sh1da9440
  • one
    Well, yes, why not. there, of course, everything will have to be worked out properly, especially when the user wants to change the type of the column, delete the field or something else. alter can not always pass ... - Mike

1 answer 1

If these forms can be divided into a small number of categories, then they can be stored in different tables. And so in one.

  • It is more convenient, of course, to store in one table. But then in this table it is necessary to select a separate column for each type (Date, Datetime, Time, etc.). After all, the data may be different. - sh1da9440
  • one
    according to one table it will be practically impossible to collect any summary data. Imagine that in the form of a dozen fields, among which there is for example a date and you need to get the sum of all values ​​for the month. on a single table with all forms, it is certainly going to, but the speed of work will be none - Mike