간단한 쿼리문 결과 왜 실행이 안될까요...; 채택완료
$total_row_sql = "select sum(total) from (
select count(*) as total from {$g5['write_locationboard_table']} where wr_is_comment != 1
union all select select(*) as total from {$g5['write_used_market_table']} where wr_is_comment != 1
union all select select(*) as total from {$g5['write_schedule_table']} where wr_is_comment != 1) tb";
$teli = array();
$total_row = mysqli_query($link, $total_row_sql);
for($i=0; $total_row_result=mysqli_fetch_array($total_row); $i++){
$teli[$i] = $total_row_result;
echo print_r($teli[$i]);
}
$rows = 13; // 목록수
쿼리문은 mysql에서 제대로 작동하는데요..
계속 이렇게 쓰고 있었는데 왜 이것만 안될까요..
저 쿼리문의 결과가 하나라서 안나오는 건가요??
답변 1개
union all select select count(*)
union all 다음에 select가 한 번 더 들어간 것 같은데 저건 오탄가요?
답변에 대한 댓글 5개
일괄수정하다 실수를 범한것 같습니다..
select count(*) as total from {$g5['write_locationboard_table']} where wr_is_comment != 1
union all select count(*) as total from {$g5['write_used_market_table']} where wr_is_comment != 1
union all select count(*) as total from {$g5['write_schedule_table']} where wr_is_comment != 1) tb";
$teli = array();
$total_row = mysqli_query($link, $total_sql);
$total_result = mysqli_fetch_array($total_row);
echo $total_result[0];
답변참고하여 해결했습니다 ㅎ 감사합니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
echo "hello"; 로 확인해봤더니 for문이 작동을 안합니다..ㅠ