여분필드 검색 최소 최대 값

여분필드 검색 최소 최대 값

QA

여분필드 검색 최소 최대 값

본문


if ($it_1)  
    $where[] = " it_1 = '$it_1' ";
 
if ($wfrom && $wto)
    $where[] = " a.it_1 between '$wfrom' and '$wto' ";

 

를 search.php에 추가하고

 


<div class="form-group">
    <label class="col-sm-2 control-label hidden-xs"><b>가로 선택</b></label>
    <div class="col-sm-10">
     <label for="ssch_wfrom" class="sound_only">최소 가로</label>
     <label class="label-none">
      <input type="text" name="wfrom" value="<?php echo $wfrom; ?>" id="ssch_wfrom" class="form-control input-sm" size="10" placeholder="최소 가로">
     </label>
     <label> ~ </label>
     <label for="ssch_wto" class="sound_only">최대 가로</label>
     <label class="label-none">
      <input type="text" name="wto" value="<?php echo $wto; ?>" id="ssch_wto" class="form-control input-sm" size="10" placeholder="최대 가로">
     </label>
    </div>
   </div>
 

 

를 스킨에 추가했습니다. 범위를 모두 적으면 정상 작동이 되는데

 

최소 값만 적고 최대 값을 안적을 시에

 

적은 최소 값 이하의 값은 안나와야 정상인데 모두 검색이 됩니다.

 

무엇이 잘못된걸까요? ㅠㅠ 

이 질문에 댓글 쓰기 :

답변 1


if ($it_1)  
    $where[] = " it_1 = '$it_1' ";
 
if ($wfrom && $wto)
    $where[] = " a.it_1 between '$wfrom' and '$wto' ";
 
 
=>
 
if ($it_1)  
    $where[] = " it_1 = '$it_1' ";
 
if ($wfrom && $wto) {
    $where[] = " a.it_1 between '$wfrom' and '$wto' ";
} else if($wfrom) {
    $where[] = " a.it_1 >= '$wfrom' ";
} else if($wto) {
    $where[] = " a.it_1 <= '$wfrom' ";
}
답변을 작성하시기 전에 로그인 해주세요.
전체 16,797
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT