$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라인 제거
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로