이해가 안되는 소스가 있어서... 설명 좀 해주세요 정보
이해가 안되는 소스가 있어서... 설명 좀 해주세요본문
게시판 스킨에 list.skin.php 와 skin.exe.php 파일이 있습니다.
리스트 스킨에서 셀렉스 박스에서 선택을 하면 그 값을 skin.exe.php 파일에 받아서
$stx 변수 집어 넣습니다.
그런데 셀렉스 박스 name은 stype1 이고 skin.exe.php에서는 $search_type1이 비어있지 않다면
실행하라고 되었습니다.
어떻게 이름이 다른데 이 값이 $search_type1 변수에 들어간 것일까요?
그 위치를 못찾겟네요 분명 $search_type1 = stype1 (짮은 소견으로는) 이런 문구가 있어야 될
거 같거든요..
그래서 제가 알고 싶은 것은 어떻게
skin.exe.php의 $search_type1이 셀렉트 박스 네임 stype1 과 같은 값이 되었는지 알고 싶습니다.
그리고 두번째로 $str이 쿼리를 날릴 때 조건으로 쓰인거 같습니다.
그런데 어디에서 $str 값이 쓰였는지 모르겟네요 list.skin.php 나 skin.exe.php 에는 없거든요
$search_type1이 비어있지 않다면
$str .= " wr_11 = '".$search_type1."' "; 하라고 되어 있는데
$str값이 어디 파일에서 쓰였는지 혹시 아시나요??
소스가 더 필요하시면 전체 올려드릴게요
----------------소 스 (list.skin.php)---------------------------------------
<INPUT name="stx" type="text" id="textfield" style="color:black ;background-color:#FFFFFF; border:2 solid; border-color:#FF9900; width:160px; height:20px;" class=input itemname="검색어" value="<?=$stx?>" /></td>
</tr>
<tr><td height="3" colspan="5"></td></tr>
<tr>
<td width="60"><b>차 종</b></td>
<td><select name="stype1">
<option value="">---------전체---------</option>
<option value="1"<?if ($stype1 == "1"){?> selected<?}?>>경차</option>
<option value="2"<?if ($stype1 == "2"){?> selected<?}?>>소형</option>
<option value="3"<?if ($stype1 == "3"){?> selected<?}?>>준중형</option>
<option value="4"<?if ($stype1 == "4"){?> selected<?}?>>중형</option>
<option value="5"<?if ($stype1 == "5"){?> selected<?}?>>대형</option>
<option value="6"<?if ($stype1 == "6"){?> selected<?}?>>SUV/RV</option>
<option value="7"<?if ($stype1 == "7"){?> selected<?}?>>승합</option>
<option value="8"<?if ($stype1 == "8"){?> selected<?}?>>화물</option>
<option value="9"<?if ($stype1 == "9"){?> selected<?}?>>수입차</option>
<option value="10"<?if ($stype1 == "10"){?> selected<?}?>>기타/특장</option>
</select></td>
<td width="20"></td>
<td width="60"><b>연 료</b></td>
<td><select name="stype2">
<option value="">---------전체---------</option>
<option value="1"<?if ($stype2 == "1"){?> selected<?}?>>가솔린</option>
<option value="2"<?if ($stype2 == "2"){?> selected<?}?>>디젤</option>
<option value="3"<?if ($stype2 == "3"){?> selected<?}?>>LPG</option>
<option value="4"<?if ($stype2 == "4"){?> selected<?}?>>전기 하이브리드</option>
<option value="5"<?if ($stype2 == "5"){?> selected<?}?>>기타</option>
</select></td>
</tr>
----------------소 스 (skin.exe.php) ----------
function get_sql_search_skin($search_ca_name, $search_field, $search_text, $search_operator='and', $search_type1, $search_type2, $search_type3, $search_type4, $search_type5)
{
global $g4;
$str = "";
if (trim($search_type1) != ""){
if ($str)
$str .= " and ";
$str .= " wr_11 = '".$search_type1."' ";
}
if (trim($search_type2) != ""){
if ($str)
$str .= " and ";
$str .= " wr_12 = '".$search_type2."' ";
}
.....
-----------------------------
리스트 스킨에서 셀렉스 박스에서 선택을 하면 그 값을 skin.exe.php 파일에 받아서
$stx 변수 집어 넣습니다.
그런데 셀렉스 박스 name은 stype1 이고 skin.exe.php에서는 $search_type1이 비어있지 않다면
실행하라고 되었습니다.
어떻게 이름이 다른데 이 값이 $search_type1 변수에 들어간 것일까요?
그 위치를 못찾겟네요 분명 $search_type1 = stype1 (짮은 소견으로는) 이런 문구가 있어야 될
거 같거든요..
그래서 제가 알고 싶은 것은 어떻게
skin.exe.php의 $search_type1이 셀렉트 박스 네임 stype1 과 같은 값이 되었는지 알고 싶습니다.
그리고 두번째로 $str이 쿼리를 날릴 때 조건으로 쓰인거 같습니다.
그런데 어디에서 $str 값이 쓰였는지 모르겟네요 list.skin.php 나 skin.exe.php 에는 없거든요
$search_type1이 비어있지 않다면
$str .= " wr_11 = '".$search_type1."' "; 하라고 되어 있는데
$str값이 어디 파일에서 쓰였는지 혹시 아시나요??
소스가 더 필요하시면 전체 올려드릴게요
----------------소 스 (list.skin.php)---------------------------------------
<INPUT name="stx" type="text" id="textfield" style="color:black ;background-color:#FFFFFF; border:2 solid; border-color:#FF9900; width:160px; height:20px;" class=input itemname="검색어" value="<?=$stx?>" /></td>
</tr>
<tr><td height="3" colspan="5"></td></tr>
<tr>
<td width="60"><b>차 종</b></td>
<td><select name="stype1">
<option value="">---------전체---------</option>
<option value="1"<?if ($stype1 == "1"){?> selected<?}?>>경차</option>
<option value="2"<?if ($stype1 == "2"){?> selected<?}?>>소형</option>
<option value="3"<?if ($stype1 == "3"){?> selected<?}?>>준중형</option>
<option value="4"<?if ($stype1 == "4"){?> selected<?}?>>중형</option>
<option value="5"<?if ($stype1 == "5"){?> selected<?}?>>대형</option>
<option value="6"<?if ($stype1 == "6"){?> selected<?}?>>SUV/RV</option>
<option value="7"<?if ($stype1 == "7"){?> selected<?}?>>승합</option>
<option value="8"<?if ($stype1 == "8"){?> selected<?}?>>화물</option>
<option value="9"<?if ($stype1 == "9"){?> selected<?}?>>수입차</option>
<option value="10"<?if ($stype1 == "10"){?> selected<?}?>>기타/특장</option>
</select></td>
<td width="20"></td>
<td width="60"><b>연 료</b></td>
<td><select name="stype2">
<option value="">---------전체---------</option>
<option value="1"<?if ($stype2 == "1"){?> selected<?}?>>가솔린</option>
<option value="2"<?if ($stype2 == "2"){?> selected<?}?>>디젤</option>
<option value="3"<?if ($stype2 == "3"){?> selected<?}?>>LPG</option>
<option value="4"<?if ($stype2 == "4"){?> selected<?}?>>전기 하이브리드</option>
<option value="5"<?if ($stype2 == "5"){?> selected<?}?>>기타</option>
</select></td>
</tr>
----------------소 스 (skin.exe.php) ----------
function get_sql_search_skin($search_ca_name, $search_field, $search_text, $search_operator='and', $search_type1, $search_type2, $search_type3, $search_type4, $search_type5)
{
global $g4;
$str = "";
if (trim($search_type1) != ""){
if ($str)
$str .= " and ";
$str .= " wr_11 = '".$search_type1."' ";
}
if (trim($search_type2) != ""){
if ($str)
$str .= " and ";
$str .= " wr_12 = '".$search_type2."' ";
}
.....
-----------------------------
댓글 전체
1. 함수 get_sql_search_skin 으로 값을 넘겨서 함수내에서 처리하는 것이니깐, 함수에서 정의한 변수를 쓰는 것입니다.
2. $str 쿼리문의 where 절에 사용하기 위한것 같습니다.
2. $str 쿼리문의 where 절에 사용하기 위한것 같습니다.