I have this multiple record insert. I need to get last id from product
and loan
table insert to table import
. How can I doing that?
This is my code:
$sql = "INSERT INTO `product` (`product_id`, `barcode`, `delete`, `id_list_name`) VALUES (NULL, '".$barcode."', '0', '".$listnameid."');
INSERT INTO `loan` (`loan_id`, `date`, `Quantity`, `delete`, `id_user`) VALUES (NULL, '".date("Y-m-d")."', '1', '0', '".$userid."');
INSERT INTO `import` (`import_id`, `id_product`, `date`, `delete`, `date delete`, `id_user`, `id_loan`) VALUES (NULL, '4', '".date("Y-m-d")."', '0', '', '".$userid."', '"4"');
";
mysqli_query($conn, $sql);