$query1 = "INSERT INTO `form_elements` (`id`, `form_id`, `element_type_id`,
`ordering`, `caption`, `att1`, `att2`, `att3`, `att4`, `att5`)
VALUES (NULL,'0','15',1,'checkbox', 6, 80, 128,'required','');
INSERT INTO `element_list_value` (`id`,`element_id`, `type`, `name`, `value`)
VALUES
(NULL,LAST_INSERT_ID(),0,'Option 1','Option 1'),
(NULL,LAST_INSERT_ID(),0,'Option 2','Option 2')"
$query2 ="INSERT INTO `form_elements` (`id`, `form_id`, `element_type_id`, `ordering`, `caption`, `att1`, `att2`, `att3`, `att4`, `att5`)
VALUES (NULL,'0','17',2,'select', 6, 80, 128,'required','');
INSERT INTO `element_list_value` (`id`,`element_id`, `type`, `name`, `value`) VALUES (NULL,LAST_INSERT_ID(),0,'option-1','option-1'),
(NULL,LAST_INSERT_ID(),0,'option-2','option-2'),
(NULL,LAST_INSERT_ID(),0,'option-3','option-3')"
$query_run = mysqli_multi_query($connection, $query1)
$query_run = mysqli_multi_query($connection, $query2)
如何使上述代码在PHP中运行?
第二个mysqli_multi_query总是无法运行。我也试过在第一次查询后释放内存,但它仍然不起作用。