반응형
# 주간 검색어
$today=time(); //오늘의 초를 구하고
$oneday=60*60*24; // 이건 하루가 몇 초인지..
$firstday=$today-date('w',$today)*$oneday; // 그 주 첫째날의 타임스탬프
$day=$firstday; for($i=0;$i<7;$i++) { $week[$i] = date('Ymd',$firstday+$oneday*$i)."<br>"; }
$q ="select count(searchTxt) as cnt,searchTxt from searchTable where FROM_UNIXTIME(searchTime, '%Y%m%d') <= '$week[6]' and FROM_UNIXTIME(searchTime, '%Y%m%d') >= '$week[0]' group by searchTxt order by cnt desc limit 20";
$rankRes2 = query($q);
반응형
'Web > PHP' 카테고리의 다른 글
www 붙이기 소스 (0) | 2016.12.02 |
---|---|
curl 예제 (0) | 2010.06.10 |
엑셀 다운로드 헤더 (0) | 2010.05.28 |
참조연산자 (&) (0) | 2010.04.29 |
php 4.x 버전과 php 5.x 버전 동시에 사용하기[리눅스 설정] (0) | 2010.04.01 |