특정 게시판의 자기가 쓴 게시물수를 출력하려고 하는데요. 정보
특정 게시판의 자기가 쓴 게시물수를 출력하려고 하는데요.본문
팁란에서 찾은 총 게시물수와 댓글수를 수정하면 가능할것 같은데 쿼리문을 잘 몰라서 못하고 있습니다. 좀 도와주세요. ^^;
<!-- 총 게시물수 뽑아오기 시작 -->
<?
//게시물수 뽑기
$results1 = sql_query(" SELECT bo_table FROM $g4[board_table] ");
$all_com = 0;
$all_art= 0;
$i=0;
while ($row13 = sql_fetch_array($results1)) {
$i++; //테이블수
//게시물
$gul_su="select count(wr_is_comment) as ctt from g4_write_$row13[bo_table] where wr_is_comment='0' ";
//코멘트
$co_su="select sum(wr_is_comment) as ctt2 from g4_write_$row13[bo_table] where wr_is_comment='1' ";
//게시물
$article = sql_fetch($gul_su);
$article_su=$article[ctt];
$all_art= $all_art +$article_su;
//코멘트
$comm= sql_fetch($co_su);
$comm_su=$comm[ctt2];
$all_com = $all_com+$comm_su;
}
?>
<!-- 총게시물수뽑아오기 끝 -->
출력
<div width="50%" align="left"> <font color="#1AA9DE"><strong>등록된 총게시물</strong></font> :
<?=number_format($all_art)?>
건 </div>
=============== 여기까지가 팁란에 게시물입니다.
여기서 mb_id = '$member[mb_id]' 를 추가하면 회원에 글수를 알수 있다던데 어디에 추가하는건가요?
그리고 전체 보드테이블이 아닌 특정테이블만 넣어서 게시물수만 뽑거나 댓글수만 뽑고 싶은데 워낙 몰라서 부탁좀 드려봅니다.;
<!-- 총 게시물수 뽑아오기 시작 -->
<?
//게시물수 뽑기
$results1 = sql_query(" SELECT bo_table FROM $g4[board_table] ");
$all_com = 0;
$all_art= 0;
$i=0;
while ($row13 = sql_fetch_array($results1)) {
$i++; //테이블수
//게시물
$gul_su="select count(wr_is_comment) as ctt from g4_write_$row13[bo_table] where wr_is_comment='0' ";
//코멘트
$co_su="select sum(wr_is_comment) as ctt2 from g4_write_$row13[bo_table] where wr_is_comment='1' ";
//게시물
$article = sql_fetch($gul_su);
$article_su=$article[ctt];
$all_art= $all_art +$article_su;
//코멘트
$comm= sql_fetch($co_su);
$comm_su=$comm[ctt2];
$all_com = $all_com+$comm_su;
}
?>
<!-- 총게시물수뽑아오기 끝 -->
출력
<div width="50%" align="left"> <font color="#1AA9DE"><strong>등록된 총게시물</strong></font> :
<?=number_format($all_art)?>
건 </div>
=============== 여기까지가 팁란에 게시물입니다.
여기서 mb_id = '$member[mb_id]' 를 추가하면 회원에 글수를 알수 있다던데 어디에 추가하는건가요?
그리고 전체 보드테이블이 아닌 특정테이블만 넣어서 게시물수만 뽑거나 댓글수만 뽑고 싶은데 워낙 몰라서 부탁좀 드려봅니다.;
댓글 전체

회원이 쓴 글수
$gul_su="select count(wr_is_comment) as ctt from g4_write_$row13[bo_table] where wr_is_comment='0' and mb_id = '$member[mb_id]' ";
회원이 쓴 덧글수
$co_su="select sum(wr_is_comment) as ctt2 from g4_write_$row13[bo_table] where wr_is_comment='1' and mb_id = '$member[mb_id]' ";
특정 테이블일 경우 and bo_table ='테이블명' 추가 하시면 됩니다.
$gul_su="select count(wr_is_comment) as ctt from g4_write_$row13[bo_table] where wr_is_comment='0' and mb_id = '$member[mb_id]' ";
회원이 쓴 덧글수
$co_su="select sum(wr_is_comment) as ctt2 from g4_write_$row13[bo_table] where wr_is_comment='1' and mb_id = '$member[mb_id]' ";
특정 테이블일 경우 and bo_table ='테이블명' 추가 하시면 됩니다.
잘됩니다. 정말 감사드립니다. ^^