실시간검색어 관련 도와주시면 감사합니다. 채택완료
</p>
<p><!-- 실시간검색어-->
<?
$fr_date = date("Y-m-d");
$to_date = date("Y-m-d");
$sql_common = " from {$g5['popular_table']} a ";
$sql_search = " where trim(pp_word) <> '' and pp_date between '{$fr_date}' and '{$to_date}' ";
$sql_group = " group by pp_word ";
$sql = " select pp_word {$sql_common} {$sql_search} {$sql_group} ";
$result = sql_query($sql);
$total_count = sql_num_rows($result);
if($total_count<10){
$fr_date = date("Y-m-d", strtotime("-3 day"));
$to_date = date("Y-m-d");
$sql_search = " where trim(pp_word) <> '' and pp_date between '{$fr_date}' and '{$to_date}' ";
}
$sql_order = " order by cnt desc ";
$sql = "select pp_word, count(*) as cnt {$sql_common} {$sql_search} {$sql_group} {$sql_order} limit 0, 10";
?>
<div class="search_list"><h3 class="tit">실시간검색어</h3>
<div class="serch_now_list">
<?php
$result1 = sql_query($sql);
for ($a=1; $row=sql_fetch_array($result1); $a++) {
$word = get_text($row['pp_word']);
?>
<a href="<?php echo G5_BBS_URL ?>/search.php?sfl=wr_subject&wr_content&sop=and&stx=<?php echo $word;?>"><em><?php echo $a;?></em> <?php echo $word;?></a>
<?php } ?>
</div>
<span class="btn_view">∨</span>
</div>
<div class="serch_now_list_view">
<ul>
<?php
$result2 = sql_query($sql);
for ($b=1; $row=sql_fetch_array($result2); $b++) {
$word = get_text($row['pp_word']);
?>
<li><a href="<?php echo G5_BBS_URL ?>/search.php?sfl=wr_subject&wr_content&sop=and&stx=<?php echo $word;?>"><em><?php echo $b;?></em> <?php echo $word;?></a></li>
<?php } ?>
</ul>
</div>
<div style="width:100%; height:10px;background-color: #e9ecf3;">
</div></p>
<p><script>
$(document).ready(function () {
$('.btn_view').click(function(){
var search_view = $(".serch_now_list_view");
if( search_view.is(":visible") ){
search_view.slideUp();
$(this).html("∨");
}else{
search_view.slideDown();
$(this).html("∧");
}
});</p>
<p> function search_list(){
$(".serch_now_list a:first").slideUp( function(){
$(this).show();
$(this).appendTo($(".serch_now_list")).slideDown();
});
}
setInterval(function(){search_list()}, 3000);
});
</script></p>
<p>
제가 정해진 특정 단어 내에서 검색 시 실시간검색어에 나타나게 하고 싶습니다.
예를 들어 과일을 주제로 한다면 사과나 포도 등 과일 이름을 입력 시에만 실검 순위에 나오게요..ㅠ
어떻게 해야하는지 알려주시면 감사합니답..!....
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
4년 전
$sql_search = " where trim(pp_word) <> '' and pp_date between '{$fr_date}' and '{$to_date}' ";</code></pre>
<p> </p>
<pre>
<code>$sql_search = " where trim(pp_word) <> '' and pp_word in ('사과','딸기','바나나') and pp_date between '{$fr_date}' and '{$to_date}' ";</code></pre>
<p>
지나가다 기초적으로 생각해보면 .......이런식일꺼 같은데..
속도가 마이 느릴꺼같다능.......ㅡ_ㅡ;
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
i
4년 전
안된다고하셔서 소스가져다가 직접 해보니 잘되는데요;;
$sql_search 가 두군데입니다.. if($total_count<10) { } 안에도 있어요
윗줄에 있는 $sql_search 형태로 된것들을
-> 아래줄에 적어놓은 $sql_search형태로 변경하시면 되요
$sql_search 가 두군데입니다.. if($total_count<10) { } 안에도 있어요
윗줄에 있는 $sql_search 형태로 된것들을
-> 아래줄에 적어놓은 $sql_search형태로 변경하시면 되요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
채택
답변대기
답변대기
채택
답변대기