|
|
|
21년 전
|
조회 354
|
|
|
|
21년 전
|
조회 365
|
|
|
|
21년 전
|
조회 337
|
|
|
|
21년 전
|
조회 316
|
|
|
|
21년 전
|
조회 587
|
|
|
|
21년 전
|
조회 965
|
|
|
|
21년 전
|
조회 370
|
|
|
|
21년 전
|
조회 632
|
|
|
|
21년 전
|
조회 621
|
|
|
|
21년 전
|
조회 507
|
|
|
|
21년 전
|
조회 648
|
|
|
|
21년 전
|
조회 1,209
|
|
|
|
21년 전
|
조회 577
|
|
|
|
21년 전
|
조회 479
|
|
|
|
21년 전
|
조회 794
|
|
|
|
21년 전
|
조회 764
|
|
|
|
21년 전
|
조회 325
|
|
|
|
21년 전
|
조회 337
|
|
|
|
21년 전
|
조회 440
|
|
|
|
21년 전
|
조회 376
|
댓글 3개
function get_sql_search($field, $stext, $soperator=0)
{
$op = "";
$str = " and ( ";
// 검색어를 구분자로 나눈다. 여기서는 공백
$s = explode(" ", $stext);
for ($i=0; $i<count($s); $i++) {
$str .= " $op ";
switch ($field) {
case "wr_subject|wr_content" :
$str .= " (wr_subject like '%$s[$i]%' or wr_content like '%$s[$i]%') ";
break;
case "ca_id" :
$str .= " ($field = '$s[$i]') ";
break;
case "wr_hit" :
case "wr_good" :
case "wr_nogood" :
$str .= " ($field >= '$s[$i]') ";
break;
case "wr_num" :
$str .= " ($field = ".((-1)*$s[$i]).") ";
break;
// 추가부분
case "allseach" :
$str .= " (wr_subject like '%$s[$i]%' or wr_content like '%$s[$i]%' or mb_name like '%$s[$i]%' ) ";
break;
// 추가부분
default :
$str .= " ($field like '%$s[$i]%') ";
break;
}
$op = ($soperator) ? " and " : " or ";
}
$str .= " ) ";
return $str;
}
위에서처럼 추가하고싶은걸 필드를 추가하고
스킨의 gblist.skin.php에서
<form name=fsearch method=get action='<?="./"?>'>
<input type=hidden name=doc value='<?=$doc?>'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<td width=50% align=right valign=bottom>
<select name=sselect class=select>
<option value='wr_subject'>제목</option>
<option value='wr_content'>내용</option>
<option value='wr_subject|wr_content'>제목+내용</option>
<option value='allsearch'>전체</option>
<option value='wr_name'>이름</option>
<option value='wr_num'>번호</option>
<option value='wr_datetime'>날짜</option>
<option value='wr_hit'>읽음</option>
<? if ($is_good) { ?><option value='wr_good'>추천</option><? } ?>
<? if ($is_nogood) { ?><option value='wr_nogood'>비추천</option><? } ?>
</select>
<input type=text name=stext size=10 required itemname='검색어' value='<?=$stext?>' >
<select name=soperator class=select>
<option value='1'>AND</option>
<option value='0'>OR</option>
</select>
<input type=image src='<?="$board_skin/search.gif"?>' border=0 alt='검색' align=absmiddle>
</td>
</form>
이런씩으로 처리하시면 되지 싶네요!