简体   繁体   English

一种有效的存储方式 <select>数据库中的选项?

[英]An efficient way to store <select>'s options in a database?

I'm making a website where there are thousands of <select></select> inputs. 我正在创建一个网站,其中有数千个<select></select>输入。 their <option></option> can be changed dinamicaly by an administrator at any time. 管理员可以随时对其<option></option>进行动态更改。 I'm actually storing each select input's options on separate tables, associating an Id and a value but this is heavy and not really great because i have ~= 100 tables and i need ~= 100 queries to display all the inputs on one page. 我实际上是将每个选择输入的选项存储在单独的表上,将一个ID和一个值相关联,但这很繁琐,而且并不是很好,因为我有〜= 100个表,并且我需要〜= 100个查询才能在一页上显示所有输入。

Is there any better storage solution ? 有没有更好的存储解决方案?

Current table exemple : 当前表示例:

Table : selectanimaltype

ID     NAME
1       pig
2       cow
3       sheep
4       fox
...     ...

And i have a thousands of table like this one 我有一千张这样的桌子

Why do you make table for every new select? 为什么要为每个新选择创建表格? Add third field select_name and select options by this field. 添加第三个字段select_name并通过该字段选择选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM