인기검색어 문의드려요
본문
한글자 단어 즉(배, 콩, 조, 껌)이런한글자는 안나오게 가능할까요
한글자 이상만 출력하고싶습니다.
아래는 인기검색어 사용하는 코드입니다.
고수님들 도움 부탁드립니다.
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$date_gap_old = date("Y-m-d", strtotime($date_gap) - ($date_cnt * 86400));
$old = array();
$sql2 = " select pp_word, count(*) as cnt from $g4[popular_table]
where pp_date between '$date_gap_old' and '$date_gap'
group by pp_word
order by cnt desc, pp_word
limit 0, 100 ";
$qry2 = sql_query($sql2);
$count = mysql_num_rows($qry2);
for ($j=0; $row2=sql_fetch_array($qry2); $j++) {
$old[$j] = $row2;
}
for ($i=0; $i<$pop_cnt; $i++)
{
for ($j=0; $j<$count; $j++) {
if ($old[$j][pp_word] == $list[$i][pp_word]) {
break;
}
}
$list[$i][pp_word] = urldecode($list[$i][pp_word]);
$list[$i][pp_rank] = $i + 1;
if ($count == $j) {
$list[$i][old_pp_rank] = 0;
$list[$i][rank_gap] = 0;
} else {
$list[$i][old_pp_rank] = $j + 1;
$list[$i][rank_gap] = $list[$i][old_pp_rank] - $list[$i][pp_rank];
}
if ($list[$i][rank_gap] > 0)
$list[$i][icon] = "up";
else if ($list[$i][rank_gap] < 0)
$list[$i][icon] = "down";
else if ($list[$i][old_pp_rank] == 0)
$list[$i][icon] = "new";
else if ($list[$i][rank_gap] == 0)
$list[$i][icon] = "nogap";
}
?>
<link rel="stylesheet" type="text/css" href="<?=$popular_skin_path?>/style.css" />
<div id="popular3">
<div class="inner">
<div align="center" class="subject">인기검색어</div>
<ol>
<? for ($i=0; $i<$pop_cnt; $i++) { ?>
<? if (empty($list[$i]['pp_word'])) continue; ?>
<li>
<div class="word t<?=sprintf("%02d", $i+1)?>"><a href="<?=$g4['path']?>/search.php?keyword=<?=urlencode($list[$i][pp_word])?>"><?=$list[$i][pp_word]?></a></div>
<div class="gap">
<? switch ($list[$i][icon]) {
case "up" : echo "<img src='{$popular_skin_path}/img/up.gif' alt='Up' class='absmiddle' />".abs($list[$i][rank_gap]).""; break;
case "down" : echo "<img src='{$popular_skin_path}/img/down.gif' alt='Down' class='absmiddle' />".abs($list[$i][rank_gap]).""; break;
case "new" : echo "<img src='{$popular_skin_path}/img/new.gif' alt='New' class='absmiddle' />"; break;
case "nogap" : echo "<img src='{$popular_skin_path}/img/nogap.gif' alt='Nogap' class='absmiddle' />"; break; } ?></div>
</li>
<? } ?>
</ol>
</div>
</div>
답변 5
이렇게 하면 되지 않을까요.
별이님 답변 감사합니다.
where length(pp_word) > 1 이걸 어느부분에 넣아야하는건가요 ㅠㅠ
$sql2 = " select pp_word, count(*) as cnt from $g4[popular_table]
where length(pp_word) > 1 and pp_date between '$date_gap_old' and '$date_gap'
group by pp_word
order by cnt desc, pp_word
limit 0, 100 ";
이게 안된다면 lib / popular.lib.php 에다가 sql 작성부분에 where 사이에 and 넣고 length(pp_word) > 1 해보세요..
!-->배워갑니다 ^^