mysqli_fetch_array 에러,, 채택완료
Copy
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개
답변을 작성하려면 로그인이 필요합니다.
로그인
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);