简体   繁体   English

如何将动态表单内容添加到mysql数据库

[英]How to Add dynamic form content to mysql database

Lets say, i have a registration page and the users table in MYSQL database has aa column for subjects.比方说,我有一个注册页面,MYSQL 数据库中的用户表有一个主题列。 And Students are required to add subjects like in this link below :::并且学生需要添加如下链接中的主题:::

https://bootsnipp.com/snippets/featured/dynamic-form-fields-add-amp-remove https://bootsnipp.com/snippets/featured/dynamic-form-fields-add-amp-remove

=== How can i code it so that all subjects will remain in the SUBJECTS column in the database (with respect to each user that registered with PHP & MYSQL with Bootstrap..? === 我该如何编码,以便所有主题都保留在数据库中的 SUBJECTS 列中(对于使用 Bootstrap 使用 PHP 和 MYSQL 注册的每个用户..?

That is to say, this specific form field can be increased or reduced based on the user registering at a time, and each user details get saved individually.也就是说,这个特定的表单字段可以根据一次注册的用户增加或减少,并且每个用户的详细信息都单独保存。 Kindly assist all.请大家帮忙。 Thanks谢谢

What you are trying to do is to violate the first normal form .你试图做的是违反第一范式 MySQL does nothing to enable you doing it because it is a really bad idea. MySQL 没有做任何事情来使您能够这样做,因为它是一个非常糟糕的主意。

The usual design in this case is to have a different table for subjects taken where you will add one row for each subject taken , containing a foreign key to keep track of the particular student.在这种情况下,通常的设计是为所学科目设置一个不同的表,您将为每个科目添加一行,其中包含一个外键以跟踪特定学生。

How to implement this in php varies a lot depending on your application stack and on whether you are using a framework which gives you some utility tools for this.如何在 php 中实现这一点会因您的应用程序堆栈以及您是否使用为您提供一些实用工具的框架而有很大差异。

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

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