조건절 질문해용 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

조건절 질문해용 정보

조건절 질문해용

본문

$str = "{$stx}";
$urldecode = urldecode($str);
$urlencode = urlencode($str);
 
$sql1 = " select ws_name, ws_memo from $g4[website_table] where ws_memo LIKE '%$stx%' ";
$ws1 = sql_fetch($sql1);
 
if ($ws1[ws_memo] == $urldecode) { //요부분
echo $ws_name;
}
 
 
이럴 경우~ if 문에서 제어를 하려면...
 
우짜나용??
 
LIKE '%$stx%' 요렇게 하니까 대략 난감...
  • 복사

댓글 전체

이놈을 사용해보세요.
> strcasecmp
> (PHP 3>= 3.0.2, PHP 4 , PHP 5)
> strcasecmp --  대소문자를 구별하지 않는 바이너리 호환 문자열 비교
http://kr2.php.net/manual/kr/function.strcasecmp.php
> where ws_memo LIKE '%$stx%'

ws_memo 필드에서 $stx 를 포함하는 내용을 조회하신후 if 문으로 다시한번 확인하시는것은 무었 때문인가요?
위처럼 한다면 모두 if문 안쪽으로 들어갈텐데...
의도하시는바를 모르겠습니다. ???

혹시 검색된것이 있을때와 없을때의 처리문제라면 다음처럼...
if ($ws1[ws_name]) {
    echo $ws1[ws_name];
}
검색결과가 없을 경우 바로가기를 감추려고 했습니다. ㅡ.ㅡ;;;



<?
$str = "{$stx}";
$urldecode = urldecode($str);
$urlencode = urlencode($str);

$sqlchkthis = " select ws_name, ws_memo from $g4[website_table] where ws_memo = '$stx' ";
$chkthis = sql_fetch($sqlchkthis);

if ($chkthis[ws_memo] == $urldecode) { // 검색 결과가 없을 경우 아래 바로가기를 나타내지 말아야 하는데~ 어떻게 짜야 할까~
?>

<b>바로가기</b><p>

<?
$sqlthis = " select ws_name, ws_memo from $g4[website_table] where ws_memo LIKE '%$stx%' ";
$resultthis = sql_query($sqlthis);

for ($i=0; $rowthis = sql_fetch_array($resultthis); $i++) {
echo $ws_name;
}

} //닫기
?>
© SIRSOFT
현재 페이지 제일 처음으로