Errormessage: Commands out of sync; you can't run this command now
PHP Mysqli에서 Stored Procedure을 호출할때 나오는 오류로 Procedure에서 다중 resultset을 리턴하고 이를 처리해 주지 않았을때 발생하는 에러 임.
$db_query = "CALL Procedure()";
$mysqli->query($db_query);
while($mysqli->more_results())
{
if($mysqli->next_result())
{
if( $sp_result = $mysqli->use_result() )
$sp_result->close();
}
}
리턴되는 결과셋을 모두 free시켜 주면 다음 쿼리 수행시에 상단과 같은 에러가 발생하지 않습니다.
댓글