검색 재질문 드립니다..
본문
검색 페이지에서 아래에서 항목을 체크하고 검색을 하는데요
<tr>
<td class="head">체육시설</td>
<td>
<ul>
<li>
<label for="info03" class="sound_only">운동장</label>
<input type="radio" name="info03" value="운동장"> 운동장
</li>
<li>
<label for="info03" class="sound_only">야구장</label>
<input type="radio" name="info03" value="야구장"> 야구장
</li>
<li>
<label for="info03" class="sound_only">체육관</label>
<input type="radio" name="info03" value="체육관"> 체육관
</li>
<li>
<label for="info03" class="sound_only">골프장</label>
<input type="radio" name="info03" value="골프장"> 골프장
</li>
</ul>
</td>
</tr>
아래는 출력 sql 문입니다. 자꾸 에러가 나는데요..
$info 부분(항목체크되서 넘어오면) 이 에러가 생깁니다..왜 이럴까요
에러 의심되는 부분 굵게 처리했습니다.
$where = " where ";
$sql_search = "";
$ca_addr = $ca_10 = $info = '';
if(trim($sido)) {
$stx2 = $sido.' '.$gugun;
$ca_addr = " and ca_addr1 like '%$stx2%' ";
}
if(trim($pe_start) && trim($pe_end)) {
$ca_10 = " and ca_10 BETWEEN '$pe_start' AND '$pe_end' ";
}
if(trim($info01) || trim($info02) || trim($info03) || trim($info04) || trim($info05)) {
$stx3 = $info03;
$info = " and (ca_3 like '%$stx3%' OR ca_4 like '%$stx3%' OR ca_5 like '%$stx3%' OR ca_6 like '%$stx3%') ";
}
if ($stx != "") {
if ($sfl != "") {
$sql_search .= " $where $sfl like '%$stx%' $ca_addr $ca_10 $info";
$where = " and ";
}
if ($save_stx != $stx)
$page = 1;
}
$sql_common = " from {$g5['g5_shop_category_table']} ";
$sql_common .= $sql_search;
체크만 되면 에러가 뜨네요..
체크 안하면 정상 검색 되구요 ..
!-->!-->
답변 1
소스는 문제 없고요.
html단에서 문제가 있는 것 같은데요
$sql_search
.=
" $where $sfl like '%$stx%' $ca_addr $ca_10 $info"
;
여기서 에러 나죠?
where like and ....
이런식으로 에러 나는 것 아닌가요???
이것이라면 $sfl like '%$stx%'
이것 처리 다시 하시고요.
아니면 info 값 가져 올 때 sfl과 stx도 같이 넘기세요.
답변을 작성하시기 전에 로그인 해주세요.