• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

mysqli_stmt_close($stmt) 관련 질문드립니다.

22.08.17 22:04 작성 조회수 158

0

안녕하세요 선생님, update_process.php 를 작성하던 중

    if(mysqli_stmt_execute($stmt)) {
        session_unset();
        session_destroy();
        mysqli_stmt_close($stmt);
        return header('Location:/auth/login.php');
    } else {
        return header('Location: /user/register.php');
    }
    return mysqli_stmt_close($stmt);

다음과 같이 작성하시는 것을 보게 되었는데요,
위와 같이 작성하면 

mysqli_stmt_execute($stmt)를 실행한 결과가 true 던지
false 던지 return을 해버려서 뒤에 

return mysqli_stmt_close($stmt); 을 실행하지 못하고 종료하게 되는것이 아닌지요?


답변 1

답변을 작성해보세요.

0

안녕하세요.
예제코드를 찾아보니 그 부분은 강의를 업로드 한 이후에 수정되어 있는 것을 봐선 제 실수인듯 싶습니다.

눈썰미가 좋으시군요! :))

if (mysqli_execute($stmt)) {
    session_unset();
    session_destroy();
    header('Location: /auth/login.php');
} else {
    header('Location: /user/update.php');
}
return mysqli_stmt_close($stmt);
nak512님의 프로필

nak512

질문자

2022.08.18

항상 빠르고 자세한 답변에 감사드립니다. 오늘 하루도 좋은 하루 되세요!