특정 게시판의 자기가 쓴 게시물수를 출력하려고 하는데요.

· 2011-10-26 (수) 02:33:10 · 1139 · 2
팁란에서 찾은 총 게시물수와 댓글수를 수정하면 가능할것 같은데 쿼리문을 잘 몰라서 못하고 있습니다. 좀 도와주세요. ^^;

<!-- 총 게시물수 뽑아오기 시작 -->
<?
//게시물수 뽑기
$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]' 를 추가하면 회원에 글수를 알수 있다던데 어디에 추가하는건가요?

그리고 전체 보드테이블이 아닌 특정테이블만 넣어서 게시물수만 뽑거나 댓글수만 뽑고 싶은데 워낙 몰라서 부탁좀 드려봅니다.;
|

댓글 2개

2011-10-26 (수) 10:00:40
회원이 쓴 글수
$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 ='테이블명' 추가 하시면 됩니다.
잘됩니다. 정말 감사드립니다. ^^
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
11-10-26 조회 1,629
11-10-26 조회 1,098
11-10-26 조회 1,633
11-10-26 조회 1,067
11-10-26 조회 1,022
11-10-26 조회 1,140
11-10-26 조회 1,002
11-10-26 조회 828
11-10-25 조회 1,643
11-10-25 조회 1,046
11-10-25 조회 1,067
11-10-25 조회 1,641
11-10-25 조회 956
11-10-25 조회 1,652
11-10-25 조회 1,006
11-10-25 조회 2,608
11-10-25 조회 1,059
11-10-25 조회 1,645
11-10-25 조회 891
11-10-25 조회 844