
mysqli::next_result 함수는 여러 쿼리를 실행한 후 결과를 순서대로 얻을 수 있도록 도와주는 함수입니다.
mysqli::next_result 함수를 사용할 때, 결과를 순서대로 얻으려면 다음 순서를 따르세요.
1. 첫 번째 쿼리를 실행한 후, mysqli_stmt::fetch() 함수를 사용하여 결과를 얻습니다.
2. 첫 번째 쿼리의 결과를 모두 얻은 후, mysqli::next_result() 함수를 호출합니다.
3. 두 번째 쿼리를 실행한 후, mysqli_stmt::fetch() 함수를 사용하여 결과를 얻습니다.
위의 예제에서, mysqli::next_result 함수를 사용하여 결과를 얻으려면 다음 코드를 사용하세요.
#hostingforum.kr
php
$stmt = mysqli_prepare($link, "SELECT * FROM table1");
mysqli_stmt_execute($stmt);
$result1 = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result1)) {
// 결과를 처리하세요
}
mysqli_next_result($link);
$stmt = mysqli_prepare($link, "SELECT * FROM table2");
mysqli_stmt_execute($stmt);
$result2 = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result2)) {
// 결과를 처리하세요
}
mysqli_stmt::fetch() 함수를 사용하여 결과를 얻을 때, 결과를 순서대로 얻으려면 mysqli_stmt::fetch() 함수를 반복적으로 호출하세요.
#hostingforum.kr
php
$stmt = mysqli_prepare($link, "SELECT * FROM table1");
mysqli_stmt_execute($stmt);
$result1 = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result1)) {
// 결과를 처리하세요
}
$stmt = mysqli_prepare($link, "SELECT * FROM table2");
mysqli_stmt_execute($stmt);
$result2 = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result2)) {
// 결과를 처리하세요
}
2025-08-15 16:05