테스트 사이트 - 개발 중인 베타 버전입니다

그룹내 글 갯수 구할수 있는지요? 채택완료

쿨한쏠로 9년 전 조회 4,055

http://sir.kr/g4_tiptech/24684">http://sir.kr/g4_tiptech/24684  이 함수를 G5로 변경하여 현재 사용중에 있습니다. 

 

</strong></p><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><?</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">// 전체글/오늘글</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">function total_today($bo_table, $fcolor) /// $fcolor는 글자색깔</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">{</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    global $g4;</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); </div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$sqlCnum = " select count(*) as Cnum from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 "; </div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$rowCnum = sql_fetch($sqlCnum);</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$sqlCnumT = " select count(*) as CnumT from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and wr_datetime >= '$intime'";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$rowCnumT = sql_fetch($sqlCnumT);</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    ob_start();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo " <span style='font-size:7pt;color:{$fcolor};'>";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo $rowCnum[Cnum];</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">if ($rowCnumT[CnumT] > 0) echo "/".$rowCnumT[CnumT];</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo "</span>";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    $content = ob_get_contents();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    ob_end_clean();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    return $content;</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">}</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">// 전체글/오늘글_카테고리</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">function total_todayCate($bo_table, $ca_name, $fcolor) ///$fcolor는 글자색깔</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">{</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    global $g4;</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); </div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$C = $ca_name;</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$sqlCnumC = " select count(*) as CnumC from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and ca_name = '$ca_name' "; </div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$rowCnumC = sql_fetch($sqlCnumC);</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$sqlCnumTC = " select count(*) as CnumTC from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and ca_name = '$ca_name' and wr_datetime >= '$intime' ";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">$rowCnumTC = sql_fetch($sqlCnumTC);</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    ob_start();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo " <span style='font-size:7pt;color:{$fcolor};'>";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo $rowCnumC[CnumC];</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">if ($rowCnumTC[CnumTC] > 0) echo "/".$rowCnumTC[CnumTC];</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">echo "</span>";</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    $content = ob_get_contents();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    ob_end_clean();</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">    return $content;</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">
</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">}</div><div style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">?></div><p><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; letter-spacing: -0.01px; line-height: normal;">
 


위의 함수 사용중인데요..

게시판 전체글이 아닌 그룹에 속한 전체글 개수를 구할 수 있을까요?

가능하다면 어떻게 수정하여 사용이 가능 할지요?

고수님들의 답변을 기다려 봅니다..

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트

$g5['group_table'] 테이블에 게시판 그룹의 정보를 가지고 있어요. 

$g5['board_table'] 테이블은 게시판의 정보를 가지고 있는 테이블이죠. 

 

$g5['group_table'] 테이블의 gr_id 값과 $g5['board_table'] 테이블의 gr_id 값이 동일한 값이죠. 

이제 답이 나왔죠.

$g5['group_table'] 테이블의 gr_id 값과 동일한 $g5['board_table'] 테이블의 gr_id 값을 찾고, 

해당하는 테이블을 카운트 하시면 됩니다.

각각의 테이블 수를 카운트하셔도 되고, union 으로 조인해서 카운트하셔도 되고요.

 

 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인