简体   繁体   English

使用多个动态复选框更新多个数据库行

[英]Update Multiple Database Rows With Multiple Dynamic Checkboxes

I have a web app that dynamically creates a table of people that have been booked to work at an event with checkboxes to show which days. 我有一个Web应用程序,该应用程序动态创建一个人表,该人已被预定在活动中使用复选框,以显示哪些日子。

屏幕截图一
I need to update the database to save the state of the checkboxes against each person. 我需要更新数据库以针对每个人保存复选框的状态。 The database structure looks like this: 数据库结构如下所示:

屏幕截图二

I have been looking around the web trying to work out how to loop through the table and update the relevant rows in the database but to no avail. 我一直在网上浏览,试图找出如何遍历表并更新数据库中的相关行,但无济于事。

I'm going to implement the solution suggested by Kevin in the comments above. 我将实施Kevin在上面的评论中建议的解决方案。

... do a second table where you refer to the id and save every day for itself, so it is easier to delete and update/insert new days. ...做第二个表,您可以在其中引用ID并为其自身保存每一天,因此更容易删除和更新/插入新的日子。

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

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