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

현재 총 게시물 갯수 뽑기

<!-- 총 게시물수 뽑아오기 시작 -->
<? 
//게시물수 뽑기
 $results1 = sql_query(" SELECT bo_table FROM $g5[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 g5_write_$row13[bo_table] where wr_is_comment='0' ";
    
    //코멘트
    $co_su="select sum(wr_is_comment) as ctt2 from g5_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>

 

 

db만들어두고

 

00시 기준으로 업데이트 하는 형태로 하면 과부하는 좀 줄일 수 있겠네요.

totalpost 라고 하나 만들고 post_counter(int) , comment_counter(int), lastupdate(date) 두개 넣고

오늘 날짜 구해서 lastupdate랑 똑같으면 업데이트 안하고 틀리면 업데이트 하는 형태로 구현하면 될듯합니다..ㅎ

 

소스 제공자 : 별을 따다줘님

댓글 작성

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

로그인하기

댓글 1개

현재 총 게시물 갯수 뽑기

게시판 목록

그누보드5 팁자료실

글쓰기
🐛 버그신고