mysqli_fetch_array 에러,,

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
mysqli_fetch_array 에러,,

QA

mysqli_fetch_array 에러,,

답변 3

본문


while(count($resData[0]) > $i){
        $sql = "CALL sp_day_room_chk('{$resData[0][$i]}')";
        $result = mysqli_query($conn,$sql);
        if(!$result){
            echo (mysqli_error($conn));
        }
        while($row = mysqli_fetch_array($result)){
            $data['ROOM_NO'] = $row['room_no'];
            $data['ROOM_DESC'] = $row['room_desc'];
            $data['ROOM_TYPE'] = $row['room_type'];
            $data['ROOM_FLOOR'] = $row['room_floor'];
            $data['ROOM_REMARK'] = $row['room_remark'];
            $data['ROOM_FO'] = $row['room_fo'];
            $data['ROOM_HK'] = $row['room_hk'];
            $data['ROOM_OO'] = $row['room_oo'];
            array_push($ajax,$data);
        }
 
        echo json_encode($ajax);
    $i++;
    }

위 처럼 while 문 안쪽에 while을 중첩해서 사용하고 그 안쪽에서 mysqli_fetch_array()를 사용했을떄  

Commands out of sync; you can't run this command now 와 mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given 에러가 나오는데...해결방법좀 제시해주실분 계신가요...

resData 는 달력만들면서 그 해당 달력의 날짜(ex 20210701 ~ 20210731) 가 나옵니다

현재 그누보드는 사용하지 않고 있습니다..

이 질문에 댓글 쓰기 :

답변 3

sp_day_room_chk

PROCEDURE(or FUNCTION )내용이 어떻게 되나요?

$ajax=array();
while(count($resData[0]) > $i){
        $sql = "CALL sp_day_room_chk('{$resData[0][$i]}')";
        $result = mysqli_query($conn,$sql);
        if(!$result){
            echo (mysqli_error($conn));
        }
        while($row = mysqli_fetch_array($result)){
            $data['ROOM_NO'] = $row['room_no'];
            $data['ROOM_DESC'] = $row['room_desc'];
            $data['ROOM_TYPE'] = $row['room_type'];
            $data['ROOM_FLOOR'] = $row['room_floor'];
            $data['ROOM_REMARK'] = $row['room_remark'];
            $data['ROOM_FO'] = $row['room_fo'];
            $data['ROOM_HK'] = $row['room_hk'];
            $data['ROOM_OO'] = $row['room_oo'];
            array_push($ajax,$data);
        }
    $i++;
    }
        echo json_encode($ajax);

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 0
© SIRSOFT
현재 페이지 제일 처음으로