动态地将多个数据数组插入数据库

时间:2018-06-11 06:08:13

标签: php mysql sql database pdo

我有一个数据库如下:

Patrol_tb

location_id int (PK)
name string null

location_tb

assign_no int (PK)

assign_tb

officer_id int (PK)
name string null

officers_tb

Error: Running AWS SAM projects locally requires Docker. Have you got it installed?

我正在尝试使用php pdo将数据数组插入patrol_tb但我却陷入了如何动态插入多个数组的多行。数据通过html选择发送,多个属性设置为on。因此,patrol_tb中的数据(location_id,assign_no,officer_id)分别从其主表动态生成。所有3个数据都在数组中,每个数组的值可以是一个或多个,它可能取决于html选择的输入。我想知道我应该使用insert语句多少次?我可以使用pdo将它全部放在一个insert语句中吗?

0 个答案:

没有答案
相关问题