$sql_search [변수 : string] > 그누3 사전

그누3 사전

$sql_search [변수 : string] 정보

$sql_search [변수 : string]

본문

$sql_search [변수 : string]

-> 파일 내부에서만 생성되는 변수, 검색어가 존재할 경우 생성된다.

-> 리스트나 뷰에서 셀렉트 할때 조건절에 추가된다.

-> 문제점> 물론 그누보드 자체의 검색에서는 $stext가 있는 경우는 $sselect가 없는 경우는 없지만
    브라우져주소창에 값을 바로 넘길경우에는 $sselect없이 $stext만 넘길경우에는 쿼리에러를 뿌린다.

    따라서 기존의 (bbs/gbviw.php에서 발췌)
    if ($stext) {
      // where 문을 얻음
      $sql_search = get_sql_search($sselect, $stext);
      .....
   
    형태가 아니라
    if (!empty($sselect) && !empty($stext)) {
      // where 문을 얻음
      $sql_search = get_sql_search($sselect, $stext, $soperator);
      .....
    로 고치는 것이 맞다.

-> bbs/gbview.php나 bbs/gbview.php 에서 두군데다 $sql_search를 얻기 위한 부분이 포함되어있다.
    그러나 두파일모두 bbs/gnuboard.php이하에 인클루드 되므로 bbs/gnuboard.php에서 공통처리하는것이
    바람직하다.

    예> bbs/gnuboard.php 106라인에 추가
   
    $sql_search = "";
    // 검색이면
    if (!empty($sselect) && !empty($stext)) {

      // where 문을 얻음
      $sql_search = get_sql_search($sselect, $stext, $soperator);
    }

    그리고 bbs/gbview.php에서는 22부터 32라인 까지는
    $search_href = "";
    $list_href = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&page=$page";
    // 검색이면
    if (!empty($sql_search)) {
        // where 문을 얻음
        $search_href = "./?doc=bbs/gnuboard.php&$qstr&page=$page";
        $list_href = "./?doc=bbs/gnuboard.php&bo_table=$bo_table";
    }

    그리고 bbs/gblist.php에서는
    16라인을
    if (!empty($sql_search)) {
    로 변경
    17라인 제거

댓글 전체

전체 29
그누3 사전 내용 검색

회원로그인

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