채택완료

게시판별 새글 개수 확인

Copy
// 오늘 전체 새글}     global $g5; // 자정을 기준으로 새글     $intime = date("Y-m-d 00:00:00");  // 자정 기준으로 새글을 검색합니다. $tmp_write_table .= $g5['board_new_table'];  $sql2 = " select bn_datetime from $tmp_write_table where bn_datetime >= '$intime' and wr_id = wr_parent";   // 새로운 글이 몇개 있는지 확인합니다.  $result2 = sql_query($sql2);   $total_count = mysql_num_rows($result2);   if ($total_count > 0) {   $str_cnt .= $total_count;   return $str_cnt;   }   else {    $str_cnt .= "0";    return $str_cnt;   } } ​

 

검색을 하다가 위와같이 방법을 찾아서 전체 새글개수 카운팅이 가능한데

특정 게시판만 새글 개수 카운팅을 하고 싶어서 조금 수정하여 하려고 했는데

미천한 실력으로 인하여 안됩니다..

방법을 하사하여 주시면 감사하겠습니다 .. 

|

답변 2개

채택된 답변
+20 포인트

상단 퀴리문에서

 

$sql2 " select bn_datetime from $tmp_write_table where bn_datetime >= '$intime' and wr_id = wr_parent and bo_table='게시판아이디' ";

 

로 bo_table 을 추가하시면 특정게시판만 가능합니다.

function new_count($table_id) {


$intime...

.....

.....

 

}

 

게시판마다 하려면 function안에 묶어 주고 echo new_count(테이블명)으로 해보세요.

 

답변을 작성하려면 로그인이 필요합니다.