<?php // (2018.5.8, 차재복, Cha Jae Bok, http://www.ktword.co.kr)
# 세션 설정
// 세션 스타트 (매 웹페이지 마다 필요)
session_start();
# db 연결 및 html 헤더부
include_once "../base_utils/config.php";
# 전달 변수
$sh = '과학';
# 쿼리문
$query = "select a.id,a.name,a.path2node_v2
,count(distinct b.no) as cnt
,@path:=getpath_v2(a.id)
,substring_index(substring_index(@path,'|',2),'|',-1) as pre_ord
,substring_index(substring_index(@path,'|',3),'|',-1) as path_str
,b.no,b.titlename,c.no,c.word
from gubun_tree_v2 a left join book_idx b on a.id=b.tree_id left join dict_word_list c on b.no=c.no
where a.id != 0 and a.name like '%{$sh}%' or b.titlename like '%{$sh}%' or c.word like '%{$sh}%'
group by a.id
order by pre_ord
";
$result=mysqli_query($dbi,$query);
if (mysqli_errno($dbi)) { echo mysqli_errno($dbi)." : ".mysqli_error($dbi)."\n";}
if (mysqli_num_rows($result) == 0) echo "일치 레코드 없음<br>";
while ( $matched = mysqli_fetch_assoc($result) ) {
$path_str = 'Top>'.str_replace('::','>',$matched[path_str]);
echo "{$path_str} : {$matched[cnt]} 개<br>";
}
# 분류 출력 함수
function ($id, $dbi) {
}
?>
"본 웹사이트 내 모든 저작물은 원출처를 밝히는 한 자유롭게 사용(상업화포함) 가능합니다"