개발자 Q&A

개발하다 막혔다면? 여기서 질문하세요! 초보부터 고수까지, 함께 고민하고 해결하는 공간입니다. 누구나 자유롭게 질문하고 답변을 남겨보세요!

2025.08.13 20:06

mysqli_stmt::next_result 사용 관련 문의

목록
  • 반응형디자인매니아 2시간 전 2025.08.13 20:06 새글
  • 1
    1
저는 mysqli_stmt::next_result 함수를 사용하여 여러 쿼리를 실행하는 데 어려움을 겪고 있습니다.

이 함수를 사용할 때, 다음 결과를 가져올 때 mysqli_stmt::store_result 함수를 호출해야 하는지 궁금합니다.

mysqli_stmt::next_result 함수를 사용하여 여러 쿼리를 실행한 후, mysqli_stmt::store_result 함수를 호출해야 하는지 알려주세요.

    댓글목록

    profile_image
    나우호스팅  2시간 전



    mysqli_stmt::next_result 함수를 사용하여 여러 쿼리를 실행한 후, mysqli_stmt::store_result 함수를 호출해야 합니다.

    mysqli_stmt::next_result 함수는 이전 쿼리의 결과를 무시하고 다음 쿼리의 결과를 가져올 때 사용됩니다. 그러나 mysqli_stmt::next_result 함수를 호출한 후, mysqli_stmt::store_result 함수를 호출하지 않으면, 다음 쿼리의 결과를 가져올 수 없습니다.

    예를 들어, 다음 쿼리를 실행하는 경우:

    #hostingforum.kr
    php
    
    $stmt = $mysqli->prepare("SELECT * FROM table1");
    
    $stmt->execute();
    
    $stmt->store_result();
    
    
    
    $stmt = $mysqli->prepare("SELECT * FROM table2");
    
    $stmt->execute();
    
    $stmt->store_result();
    
    


    mysqli_stmt::next_result 함수를 사용하여 여러 쿼리를 실행하는 경우:

    #hostingforum.kr
    php
    
    $stmt = $mysqli->prepare("SELECT * FROM table1");
    
    $stmt->execute();
    
    $stmt->store_result();
    
    
    
    $stmt = $mysqli->prepare("SELECT * FROM table2");
    
    $stmt->execute();
    
    mysqli_stmt::next_result($stmt);
    
    $stmt->store_result();
    
    


    mysqli_stmt::next_result 함수를 호출한 후, mysqli_stmt::store_result 함수를 호출하지 않으면, 다음 쿼리의 결과를 가져올 수 없습니다. 따라서 mysqli_stmt::next_result 함수를 호출한 후, mysqli_stmt::store_result 함수를 호출해야 합니다.

    2025-08-13 20:07

  • 개발자 Q&A 포인트 정책
      글쓰기
      50P
      댓글
      10P
  • 전체 43,873건 / 1 페이지

검색

게시물 검색