카테고리 오늘 올라온 글 갯수 가져오기 정보
카테고리 오늘 올라온 글 갯수 가져오기본문
//카테고리 오늘 새글
function board_cat_number($table_id, $cat_id){
// 자정을 기준으로 새글
$intime = date("Y-m-d 00:00:00");
// 자정 기준으로 새글을 검색합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime' and ca_name = '$cat_id'";
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= "".$total_count."";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
팁자료실에서 게시판 새글로 올라온것에 and ca_name = '$cat_id'만 추가했습니다.
<?=board_cat_number(bo_table, ca_name);?> 으로 불러오면 됩니다.
추천
3
3
댓글 0개