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개

현재 총 게시물 갯수 뽑기
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
20-10-27 조회 1.7만
20-10-27 조회 8,070
20-10-21 조회 8,271
20-10-20 조회 8,662
20-10-20 조회 8,856
20-10-14 조회 1.2만
20-10-13 조회 8,932
20-10-11 조회 9,878
20-10-11 조회 8,817
20-10-08 조회 1만
20-10-08 조회 8,435
20-10-07 조회 9,950
20-10-04 조회 9,788
20-09-28 조회 1만
20-09-26 조회 1.1만
20-09-25 조회 1.3만
20-09-24 조회 8,808
20-09-22 조회 1.1만
20-09-21 조회 8,695
20-09-17 조회 8,233
20-09-16 조회 9,048
20-09-16 조회 9,072
20-09-13 조회 1.1만
20-09-11 조회 1만
20-09-10 조회 9,609
20-09-10 조회 8,120
20-09-08 조회 8,025
20-09-08 조회 9,554
20-09-08 조회 8,023
20-09-07 조회 1만