기간내 이름검색
본문
list.skin
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" id="stx" class="frm_input redate search_box" placeholder="날짜검색">
~
<input type="text" name="stx2" value="<?php echo stripslashes($stx2) ?>" id="stx2" class="frm_input redate search_box" placeholder="날짜검색">
<label for="stx3" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx3" value="<?php echo stripslashes($stx3) ?>" id="stx3" class="frm_input search_box" placeholder="성함">
<button type="submit" value="검색" class="sch_btn">검색</button>
</form>
list.php
if ($sca || $stx || $stx === '0') { //검색이면
$is_search_bbs = true; //검색구분변수 true 지정
// 기간별 검색
if($bo_table == "cscenter") {
$sql_search=" wr_29 between '{$stx}' and '{$stx2}' and wr_9 like '%{$stx3}%' ";
} else
// 기간별 끝
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
기간별 검색내에 이름을 검색해서 사용하는데..
이름을 빼고 기간만 검색할때는 잘 되는데 기간을 빼고 이름만 검색하면 검색이 되질 않네요
이름만 검색하고 싶을때는 어떻게 해야 할까요?
!-->!-->답변 2
if($bo_table == "cscenter") {
$sql_search=" wr_29 between '{$stx}' and '{$stx2}' and wr_9 like '%{$stx3}%' ";
}
를
if($bo_table == "cscenter") { if((isset($stx3)) && (empty($stx) && empty($stx2))){ $sql_search=" wr_9 like '%{$stx3}%' "; }else{ $sql_search=" wr_29 between '{$stx}' and '{$stx2}' and wr_9 like '%{$stx3}%' "; } }
로
$stx = ''
$stx2 = '' 으로 들어와서 그런거같은디요
답변을 작성하시기 전에 로그인 해주세요.