요거 문제점 좀 봐주세요... 정보
요거 문제점 좀 봐주세요...본문
<?
// 취소
$cancel1 = sql_fetch(" select sum(wr_9) as sub_cancel from $write_table where ca_name='취소' ");
$cancel2 = sql_fetch(" select count(*) as num_cancel from $write_table where ca_name='취소' and wr_comment=0 ");
$sum_cancel = $cancel1[sub_cancel]; //취소총액
$cnt_cancel = $cancel2[num_cancel]; //취소건수
// 완료
$finish1 = sql_fetch(" select sum(wr_9) as sub_finish from $write_table where ca_name='완료' ");
$finish2 = sql_fetch(" select count(*) as num_finish from $write_table where ca_name='완료' and wr_comment=0 ");
$sum_finish = $finish1[sub_finish]; // 완료총액
$cnt_finish = $finish2[num_finish]; // 완료건수
$cancel1 = sql_fetch(" select sum(wr_9) as sub_cancel from $write_table where ca_name='취소' ");
$cancel2 = sql_fetch(" select count(*) as num_cancel from $write_table where ca_name='취소' and wr_comment=0 ");
$sum_cancel = $cancel1[sub_cancel]; //취소총액
$cnt_cancel = $cancel2[num_cancel]; //취소건수
// 완료
$finish1 = sql_fetch(" select sum(wr_9) as sub_finish from $write_table where ca_name='완료' ");
$finish2 = sql_fetch(" select count(*) as num_finish from $write_table where ca_name='완료' and wr_comment=0 ");
$sum_finish = $finish1[sub_finish]; // 완료총액
$cnt_finish = $finish2[num_finish]; // 완료건수
?>
라고해놓게 있습니다.
wr_9에 금액이 저장되어 있어서... 하나는 금액의 총계 하나는 건수 총합을 나타냅니다.
총 4개의 글이 있는데..
취소라는 카테고리에 2개의 게시글이 있고..
완료라는 카테고리에도 2개의 게시글이 있습니다.
이것을...
완료 : <?=number_format($cnt_finish)?></font>건 , <?=number_format($sum_finish)?></font>원
취소 : <?=number_format($cnt_cancel)?></font>건 , <?=number_format($sum_cancel)?></font>원
취소 : <?=number_format($cnt_cancel)?></font>건 , <?=number_format($sum_cancel)?></font>원
이렇게 나오게 했습니다.
헌데.. 결과가...
완료 : 0건 , 금액원
취소 : 2건 , 금액원
식으로.. 완료가 2건으로 나와야하는데 나오지 않습니다.. OTL
아무리 봐도 오타도 안보이고.. 왜 완료 건수만 안나오는지 모르겠습니다.
오타인지 구문오류인지... 좀 찾아주세요~~ ㅠㅁㅠ
댓글 전체
생각해 볼 문제......
카테고리가 완료가 읍따.....?...이러면 대략 OTL
합계부분은 and wr_comment=0 를 and wr_is_comment = '0' 으로 바꾸어 보세요....
위 구문에서 갯수구하는 부분은 특별히 문제가 없어 보입니다.....ㅠ.ㅠ
카테고리가 완료가 읍따.....?...이러면 대략 OTL
합계부분은 and wr_comment=0 를 and wr_is_comment = '0' 으로 바꾸어 보세요....
위 구문에서 갯수구하는 부분은 특별히 문제가 없어 보입니다.....ㅠ.ㅠ
and wr_comment=0 <- 요놈이 문제 인듯 보이네요.
wr_comment=0 는 원글에서 코멘트가 하나두 없는 부모글
wr_is_comment =0 는 코멘트가 아닌 부모글 wr_is_comment =1 코멘트글
wr_comment=0 는 원글에서 코멘트가 하나두 없는 부모글
wr_is_comment =0 는 코멘트가 아닌 부모글 wr_is_comment =1 코멘트글
오호.. 그걸 몰랐군요..
완료된 글에는 코멘트가 있었거든요... 아... 이런... 감사합니다~ ^0^/
완료된 글에는 코멘트가 있었거든요... 아... 이런... 감사합니다~ ^0^/