여분필드 검색 최소 최대 값
본문
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' ";
}
답변을 작성하시기 전에 로그인 해주세요.