그누보드의 3일최다댓글 구현.. 정보
그누보드의 3일최다댓글 구현..본문
질문을 검색해도 없거나 찾지 못해 올립니다.
그누보드 오른쪽에 있는 3일 최다 댓글을 뽑으려면 sql문에서 어떻게 처리해야 하나요 ?
그누보드 오른쪽에 있는 3일 최다 댓글을 뽑으려면 sql문에서 어떻게 처리해야 하나요 ?
댓글 전체
조건0, 전체 게시판 테이블 로드
조건1, 현제 날짜에서 3일전것까지 로드
조건2, 댓글수로 desc
조건1, 현제 날짜에서 3일전것까지 로드
조건2, 댓글수로 desc
$tsql = sql_query("select count( wr_id ) AS cnt, bo_table, wr_parent from $g4[board_new_table] where bn_datetime >= ( now( ) - INTERVAL 3 DAY ) and bn_datetime <= now( ) group by bo_table, wr_parent order by cnt desc limit 10");
for($i=0; $temp = sql_fetch_array($tsql); $i++) {
$temp1[$i] = $temp;
}
@mysql_free_result($tsql);
unset($temp);
foreach($temp1 as $temp) {
$array_new = sql_fetch(" select count(wr_comment) AS cnt from ". $g4['write_prefix'].$temp[bo_table]. " where wr_id = '$temp[wr_id]' order by cnt desc limit 10");
if($array_new['wr_subject']=="") {
echo "<a href=\"".$g4['path']."/bbs/board.php?bo_table=$temp[bo_table]&wr_id=$temp[wr_id]\">".cut_str($array_new['wr_content'], 16,'...')." <font color='#999999' style='font-size:8pt;'>(".$array_new['wr_hit'].")</a></font><br>";
} else {
echo "<a href=\"".$g4['path']."/bbs/board.php?bo_table=$temp[bo_table]&wr_id=$temp[wr_id]\">".cut_str($array_new['wr_subject'], 16,'...')." <font color='#999999' style='font-size:8pt;'>(".$array_new['wr_hit'].")</a></font><br>";
}
unset($temp1);
unset($array_new);
이렇게 하는데 도무지 개념은 이해가 가는데... 막상 그림은 안 그려지네요
for($i=0; $temp = sql_fetch_array($tsql); $i++) {
$temp1[$i] = $temp;
}
@mysql_free_result($tsql);
unset($temp);
foreach($temp1 as $temp) {
$array_new = sql_fetch(" select count(wr_comment) AS cnt from ". $g4['write_prefix'].$temp[bo_table]. " where wr_id = '$temp[wr_id]' order by cnt desc limit 10");
if($array_new['wr_subject']=="") {
echo "<a href=\"".$g4['path']."/bbs/board.php?bo_table=$temp[bo_table]&wr_id=$temp[wr_id]\">".cut_str($array_new['wr_content'], 16,'...')." <font color='#999999' style='font-size:8pt;'>(".$array_new['wr_hit'].")</a></font><br>";
} else {
echo "<a href=\"".$g4['path']."/bbs/board.php?bo_table=$temp[bo_table]&wr_id=$temp[wr_id]\">".cut_str($array_new['wr_subject'], 16,'...')." <font color='#999999' style='font-size:8pt;'>(".$array_new['wr_hit'].")</a></font><br>";
}
unset($temp1);
unset($array_new);
이렇게 하는데 도무지 개념은 이해가 가는데... 막상 그림은 안 그려지네요