$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)
How can I make the above code work in PHP?
The second mysqli_multi_query always fail to run. I have also tried freeing up the memory after the first query, but it still does not work.