회원리스트에 글수, 댓글수 출력 정보
회원리스트에 글수, 댓글수 출력
첨부파일
본문
댓글 전체


휴 이거했는데.. 리스트에 제것만 나옵니다 ㅠ.ㅠ 테이블에서 쭉 돌리려면 어떻게 해야할까요?
파일첨부합니다~
파일첨부합니다~

g4_point하고 join하고 group by mb_id, po_action 해서
count 세시면 될 듯합니다.
count 세시면 될 듯합니다.
g4_point 는 포인트 정책을 사용할때만 가능해서 곤란하고 [행님]님의 참고주소가 적당합니다...물론 그누보드 원본에 손대지 않아서 새글테이블이 정상작동할때의 얘기지만요
리스트에 자기것이라도 나온다면 기본은 맞지만 참고링크에 있는 $mb_id를 잘못 넣으신게 아닌가 싶네요....적용하신 소스를 봐야 알겠지만 올린 파일을 보면 $mb_id대신에 $row[mb_id]가 맞습니다...물론 이 문장은 for ($i=0; $row=sql_fetch_array($result); $i++) 안으로 들어가 있어야 하구요
리스트에 자기것이라도 나온다면 기본은 맞지만 참고링크에 있는 $mb_id를 잘못 넣으신게 아닌가 싶네요....적용하신 소스를 봐야 알겠지만 올린 파일을 보면 $mb_id대신에 $row[mb_id]가 맞습니다...물론 이 문장은 for ($i=0; $row=sql_fetch_array($result); $i++) 안으로 들어가 있어야 하구요

g4_point대신
g4_board_new를 써도 되긴합니다만
역시 장단점이 있네요.
g4_board_new를 써도 되긴합니다만
역시 장단점이 있네요.

삼윤님께 문의 드림...니다. 아래로 했을 경우 댓글 수가 전부 '4'로 나오는데 무엇이 잘못되었는지요 ?
<? for ($i=0; $row=sql_fetch_array($result); $i++) {
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="right"><?=$cmt_cnt?></font></td>
<? } ?>
물론 글수는 출력이 됩니다만...
<?
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
$post_cnt = $row['cnt'];
?>
<td height="35" align="right"><?=$post_cnt?></font></td>
<? for ($i=0; $row=sql_fetch_array($result); $i++) {
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="right"><?=$cmt_cnt?></font></td>
<? } ?>
물론 글수는 출력이 됩니다만...
<?
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
$post_cnt = $row['cnt'];
?>
<td height="35" align="right"><?=$post_cnt?></font></td>
모든 회원이 다 똑같은 코멘트 숫자가 나온다면(실제로 다 똑같은 숫자를 달지 않았고;;)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
에 문제가 있을수 있습니다.
echo $sql2;
로 해당 문구가 어떻게 나오는지 보세요...회원이 안바뀌고 있지나 않은지 보세요
주신 페이지와 코드를 제 홈피에 테스트결과 제대로 나오고 있습니다.
혹시 글수 출력하는게 댓글보다 위에 있다면
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
로 인해서 $row값들이 다 갱신되면서 이상해질 수 있습니다.
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
에 문제가 있을수 있습니다.
echo $sql2;
로 해당 문구가 어떻게 나오는지 보세요...회원이 안바뀌고 있지나 않은지 보세요
주신 페이지와 코드를 제 홈피에 테스트결과 제대로 나오고 있습니다.
혹시 글수 출력하는게 댓글보다 위에 있다면
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
로 인해서 $row값들이 다 갱신되면서 이상해질 수 있습니다.

아래 위 순서를 바꾸니 제대로 출력이 됩니다.
감사합니다. 삼윤님
<?
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="center"><?=$cmt_cnt?></font></td>
<?
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
$post_cnt = $row['cnt'];
?>
<td height="35" align="center"><?=$post_cnt?></font></td>
감사합니다. 삼윤님
<?
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="center"><?=$cmt_cnt?></font></td>
<?
$sql = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row = sql_fetch($sql);
$post_cnt = $row['cnt'];
?>
<td height="35" align="center"><?=$post_cnt?></font></td>
$sql3 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row3 = sql_fetch($sql3);
로 하셔되 해결되십니다...$row=sql_fetch_array($result); 로 $row에 회원정보가 있어야 되는데 글수를 담아온 정보를 넣으셨으니 회원정보가 날라가버려서 그렇게 된것이구요 4는 비회원이 단 코펜트 수로 추정되네요
$row3 = sql_fetch($sql3);
로 하셔되 해결되십니다...$row=sql_fetch_array($result); 로 $row에 회원정보가 있어야 되는데 글수를 담아온 정보를 넣으셨으니 회원정보가 날라가버려서 그렇게 된것이구요 4는 비회원이 단 코펜트 수로 추정되네요

해결된 소스입니다. 감사합니다.
<?
$sql3 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row3 = sql_fetch($sql3);
$post_cnt = $row3['cnt'];
?>
<td height="35" align="center"><?=$post_cnt?></font></td>
<?
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="center"><?=$cmt_cnt?></font></td>
<?
$sql3 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id = wr_parent ";
$row3 = sql_fetch($sql3);
$post_cnt = $row3['cnt'];
?>
<td height="35" align="center"><?=$post_cnt?></font></td>
<?
// 내가 쓴 전체 코멘트 (new 테이블 기록)
$sql2 = " select count(*) as cnt from $g4[board_new_table] where mb_id = '$row[mb_id]' and wr_id != wr_parent ";
$row2 = sql_fetch($sql2);
$cmt_cnt = $row2['cnt']; // mb_id가 쓴 코멘트 갯수
?>
<td height="35" align="center"><?=$cmt_cnt?></font></td>

근데 위에것을 적용했는데.. 뭔가 이상해요.. 댓글수가 몇백개가 나와야 하는데 몇십개정도만 나옵니다..