그런 기능이 필요하면 페이지를 열때 별도로 페이지 뷰수 누계를 기록하는 기능을 넣으면 출력시 쿼리도 줄일 수 있고 출력방법도 간단하게 되겠지만 어려울테니
기본 상태에서 가능한 방법으로 합계를 내는 코드를 만들어드리겠습니다
(게시판 마다 게시물수가 몇만개씩으로 쌓여가면 별로 좋은 방법이 아닙니다)
접속자마다 이런 처리를 해야하니 더욱 그렇습니다
$totalcnt=0;
$result = sql_query("select bo_table from $g4[board_table]");
for ($i=0; $row=sql_fetch_array($result); $i++) {
$table= $g4[write_prefix].$row[bo_table];
$tmp=sql_fetch("select sum(wr_hit) as cnt from $table");
$totalcnt+=$tmp[cnt];
}
댓글 5개
어제, 오늘은 따로 저장하지 않으므로 합계를 낼 수 없습니다
그럼,전체페이지뷰와 게시판 총수는 출력이 될까요?
기본 상태에서 가능한 방법으로 합계를 내는 코드를 만들어드리겠습니다
(게시판 마다 게시물수가 몇만개씩으로 쌓여가면 별로 좋은 방법이 아닙니다)
접속자마다 이런 처리를 해야하니 더욱 그렇습니다
$totalcnt=0;
$result = sql_query("select bo_table from $g4[board_table]");
for ($i=0; $row=sql_fetch_array($result); $i++) {
$table= $g4[write_prefix].$row[bo_table];
$tmp=sql_fetch("select sum(wr_hit) as cnt from $table");
$totalcnt+=$tmp[cnt];
}
echo "게시판수 : ".$i;
echo " 조회수 : ".$totalcnt;
그런데 전체 조회수 합계가 무슨 의미가 있는지 모르겠네요
<tr>
<td style="padding-left:15;" colspan="3" span class="bu" height="22"></span> <a href="#">어제가입자 :
</a> <font color="#666666" style="font-size:9pt;">
<?
$row = sql_fetch(" select count(*) as cnt from $g4[member_table] where left(mb_datetime,10) = '".date("Y-m-d", time()-86400)."' ");
echo "$row[cnt]명";
?>
</font></td>
</tr>
<tr>
<td style="padding-left:15;" colspan="3" span class="bu" height="22"></span> <a href="#">전체회원수 :
</a><font color="#666666" style="font-size:9pt;">
<?
$row = sql_fetch(" select count(*) as cnt from $g4[member_table] ");
echo "$row[cnt]명<br>";
?></td></tr>
<tr>
<td style="padding-left:15;" colspan="3" span class="bu" height="22"></span> <a href="#">전체방문자 :
<?=number_format($visit[4])?>명
</a></td>
</tr>
좀 무리겠지요?^.^