w

현재 총 게시물 갯수 뽑기

<!-- 총 게시물수 뽑아오기 시작 -->
<? 
//게시물수 뽑기
 $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 팁자료실

+
제목 글쓴이 날짜 조회
5년 전 조회 2,928
5년 전 조회 3,024
5년 전 조회 3,439
5년 전 조회 4,994
5년 전 조회 4,893
5년 전 조회 4,044
5년 전 조회 5,297
5년 전 조회 4,432
5년 전 조회 4,543
5년 전 조회 8,223
5년 전 조회 3,776
5년 전 조회 4,386
5년 전 조회 1.2만
5년 전 조회 3,253
5년 전 조회 3,377
5년 전 조회 3,802
5년 전 조회 3,851
5년 전 조회 5,955
5년 전 조회 3,125
5년 전 조회 4,466
5년 전 조회 3,530
5년 전 조회 4,902
5년 전 조회 3,552
5년 전 조회 5,102
5년 전 조회 4,821
5년 전 조회 5,155
5년 전 조회 5,969
5년 전 조회 7,477
5년 전 조회 3,892
5년 전 조회 6,137