그룹내 글 갯수 구할수 있는지요?
본문
http://sir.kr/g4_tiptech/24684 이 함수를 G5로 변경하여 현재 사용중에 있습니다.
<?
// 전체글/오늘글
function total_today($bo_table, $fcolor) /// $fcolor는 글자색깔
{
global $g4;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$sqlCnum = " select count(*) as Cnum from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 ";
$rowCnum = sql_fetch($sqlCnum);
$sqlCnumT = " select count(*) as CnumT from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and wr_datetime >= '$intime'";
$rowCnumT = sql_fetch($sqlCnumT);
ob_start();
echo " <span style='font-size:7pt;color:{$fcolor};'>";
echo $rowCnum[Cnum];
if ($rowCnumT[CnumT] > 0) echo "/".$rowCnumT[CnumT];
echo "</span>";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
// 전체글/오늘글_카테고리
function total_todayCate($bo_table, $ca_name, $fcolor) ///$fcolor는 글자색깔
{
global $g4;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$C = $ca_name;
$sqlCnumC = " select count(*) as CnumC from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and ca_name = '$ca_name' ";
$rowCnumC = sql_fetch($sqlCnumC);
$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' ";
$rowCnumTC = sql_fetch($sqlCnumTC);
ob_start();
echo " <span style='font-size:7pt;color:{$fcolor};'>";
echo $rowCnumC[CnumC];
if ($rowCnumTC[CnumTC] > 0) echo "/".$rowCnumTC[CnumTC];
echo "</span>";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
위의 함수 사용중인데요..
게시판 전체글이 아닌 그룹에 속한 전체글 개수를 구할 수 있을까요?
가능하다면 어떻게 수정하여 사용이 가능 할지요?
고수님들의 답변을 기다려 봅니다..
!-->답변 1
$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 으로 조인해서 카운트하셔도 되고요.
답변을 작성하시기 전에 로그인 해주세요.