What is the best option for auxiliary tables?

0

Let's say that in a registration form I have several fields whose values are selectable and for each field the list of values is different from the others, the conventional would be to create a table for each field with the options and to display in the select. p>

  • But when it is necessary to create a very large number of these tables?
  • Will I have to make a table for each select that is different?
  • I thought about creating a recursive table for the selects options with Id, IdPai e Nome , I'm told, or is there another better way to to do this?

Let's go to the practical example:

I have a main table with 10 INT (11) fields that will be populated in a form according to the user's choice, ID based on the values of a different select list for each field, each field has its own ID tag and values to display.

In this example I would have to create 10 auxiliary tables , one for each select list that I put on the form.

What I want to know is if you are creating a table from categories of selects with a IDPai , a ID > and the name of select I would achieve the same result as the previous example.

In this way I could have a parent category with the name " SELECT1 " and several child categories containing the values of that parent " Yes "; " no "; " maybe "; and so on, " SELECT2 " -> " On "; " Off ", and in the main table I would save the ID that was selected .

    
asked by anonymous 19.04.2017 / 20:38

2 answers

0

Ever wondered if you need to add any additional field to this generic table? What if the indices in this table differ according to the related search? What if physical and logical deletion occurs for different fields with different actions?

I would go to the tables. Costly to implement at this point but will give you a head start if any new implementation or extension of table properties is required.

    
19.04.2017 / 20:54
0

For now I'm going to use the category model with Tree View, but if someone has some other idea put there to see, I have not worked with PHPBB for some time, but if I'm not mistaken they use parameters from a table for the variables of the system, values are stored as an array in a table field.

My implementation was as follows, the structure of the auxiliary table looks like this:

The VALUE field has been added so that you can choose the options, not that I could not use ID since it is unique, but to sequentially organize the value of < options >

AsIwasoutIgotthiscoderightherefromthecommunityandmademychanges: System Categories and Subcategories / Infinite Children

I put a condition at the beginning of the output to show the action buttons only for the options and not for the main categories. if ($ catPai! = 0) {show buttons}

And the end result looks like this:

    
20.04.2017 / 01:48