공식 문서 에 따르면 두 가지 방법이 있습니다. 객체 지향 방식을 사용하지 않기 때문에 절차 적 방식의 예제 (내가 말했듯이 문서에서)를 거의 복사하여 붙여 넣을 것입니다.
// Your queries
$query="INSERT into statement(statementno) VALUES('".$statementno."')";
$query.="INSERT into
receipt(statementno,accountnum,dateofpayment,amount,submittedby)
VALUES('".$statementno."','".$accno."','".$dateofpayment."','".$amount."','".$submittedby."')";
/* execute multi query */
if (mysqli_multi_query($con, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($con)) {
while ($row = mysqli_fetch_row($result)) {
printf("%s\n", $row[0]); // Or whatever...
}
mysqli_free_result($result); // Free in order to store the next
}
}
} while (mysqli_next_result($con));
}
출처
https://stackoverflow.com/questions/22089787