오늘 글 수/ 전체글 수 어떻게 나타낼까요?(이미지 참고) 정보
오늘 글 수/ 전체글 수 어떻게 나타낼까요?(이미지 참고)관련링크
본문
이미지를 참고해주세요.
만들고 싶은 방식
자유게시판 : 오늘 글 수(코멘트수) / 전체 글 수 (코멘트수)
예를 들면
freeboard : 10(3) / 215(103)
이런 형태로 만들어 보고 싶어요.
어떻게 해 보면 될까요?
그누 3에는 몇가지가 있던데요..
그누 4에서는 잘 되지 않아서요.ㅡ.ㅡ
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=9
응용하고 싶어서
해보니 오류가 생깁니다.
http://www.e6e3.com/board/my_entry.php
Fatal error: Call to undefined function: sql_fetch_array() in /home1/e6e3/public_html/board/my_entry.php on line 30
30 while($row=sql_fetch_array($rs)) {
31 $group_list[$row[gr_id]]=$row;
32 }
만들고 싶은 방식
자유게시판 : 오늘 글 수(코멘트수) / 전체 글 수 (코멘트수)
예를 들면
freeboard : 10(3) / 215(103)
이런 형태로 만들어 보고 싶어요.
어떻게 해 보면 될까요?
그누 3에는 몇가지가 있던데요..
그누 4에서는 잘 되지 않아서요.ㅡ.ㅡ
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=9
응용하고 싶어서
해보니 오류가 생깁니다.
http://www.e6e3.com/board/my_entry.php
Fatal error: Call to undefined function: sql_fetch_array() in /home1/e6e3/public_html/board/my_entry.php on line 30
30 while($row=sql_fetch_array($rs)) {
31 $group_list[$row[gr_id]]=$row;
32 }
댓글 전체
간단하게 함수로 만들어봤습니다
응용해보세요
//게시물수 리턴 (data[new_post]/data[all_post]/data[new_ment]/data[all_ment]
function get_board_count($bo_table){
global $config;
global $g4;
$data = array();
$sql = " select * from {$g4[board_table]} where table_id = '$bo_table'";
$board = sql_fetch($sql);
$data[all_post] = $board[bo_count_write]; // ALL POST Count;
$data[all_ment] = $board[bo_count_comment]; // ALL MENT Count;
$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 전체이름
$STime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); //24 시간이내 글만.
$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 0";
$result = sql_query($sql);
$new_post = mysql_num_rows($result);
$data[new_post]=$new_post; // NEW POST Count;
$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 1";
$result = sql_query($sql);
$new_ment = mysql_num_rows($result);
$data[new_ment]=$new_ment; // NEW MENT Count;
return $data;
}
이 함수를 이용한 사용법은
$data=get_board_count("freeboard"); //게시판 보드테이블 명
echo $data[all_post]; // 전체 개수
echo $data[new_post]; // 24시간이내 글수
echo $data[all_ment];// 전체 멘트수
echo $data[new_ment];//24시간이내 멘트수
응용해보세요 잘되길 빕니다
응용해보세요
//게시물수 리턴 (data[new_post]/data[all_post]/data[new_ment]/data[all_ment]
function get_board_count($bo_table){
global $config;
global $g4;
$data = array();
$sql = " select * from {$g4[board_table]} where table_id = '$bo_table'";
$board = sql_fetch($sql);
$data[all_post] = $board[bo_count_write]; // ALL POST Count;
$data[all_ment] = $board[bo_count_comment]; // ALL MENT Count;
$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 전체이름
$STime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); //24 시간이내 글만.
$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 0";
$result = sql_query($sql);
$new_post = mysql_num_rows($result);
$data[new_post]=$new_post; // NEW POST Count;
$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 1";
$result = sql_query($sql);
$new_ment = mysql_num_rows($result);
$data[new_ment]=$new_ment; // NEW MENT Count;
return $data;
}
이 함수를 이용한 사용법은
$data=get_board_count("freeboard"); //게시판 보드테이블 명
echo $data[all_post]; // 전체 개수
echo $data[new_post]; // 24시간이내 글수
echo $data[all_ment];// 전체 멘트수
echo $data[new_ment];//24시간이내 멘트수
응용해보세요 잘되길 빕니다