게시판 리스트 검색에 관해서 질문드립니다. > 그누4 질문답변

그누4 질문답변

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

게시판 리스트 검색에 관해서 질문드립니다. 정보

게시판 리스트 검색에 관해서 질문드립니다.

본문

게시판 리스트가 skin/board/zbasic/list.skin.php

이런식으로 되서 불러오잖아요...

그런데 거기서 검색을 기본검색을 말고 컬럼 내용중에 여러개를 추가해서 검색을 해야해서

만들려고 하는데 어떻게 달아야 하나요

게시물마다 검색이 조금 틀려지는데 list.skin.php 에다가 검색 부분을 달아야 할까요?

$sql_common = " from ".g4_write_."$board[bo_table]";

$sql_search = " where (1) ";
if ($stx) {
    $sql_search .= " and ( ";
    switch ($sfl) {
        case "mb_point" :
            $sql_search .= " ($sfl >= '$stx') ";
            break;
        case "mb_level" :
            $sql_search .= " ($sfl = '$stx') ";
            break;
        case "mb_tel" :
        case "mb_hp" :
            $sql_search .= " ($sfl like '%$stx') ";
            break;
        default :
            $sql_search .= " ($sfl like '$stx%') ";
            break;
    }
    $sql_search .= " ) ";
}

$where1 = " ";
$year_age = time();
$year_age = date("Y", $year_age);

if($area1_search){
 $where1 = $where1." and mm_addr like '".$area1_search."%' ";
}

if($mm_don != 0) $where1 = $where1." and mm3_fund >= ".$mm_don." ";
if($mm_don2 != 0) $where1 = $where1." and mm3_fund <= ".$mm_don2." ";
if($mb_birth1 != 0){
 $search_birth1 = $year_age - $mb_birth1;
 $where1 = $where1." and substring(mb_birth,1,4) <= ".$search_birth1." ";
}
if($mb_birth2 != 0){
 $search_birth2 = $year_age - $mb_birth2;
 $where1 = $where1." and substring(mb_birth,1,4) >= ".$search_birth2." ";
}
if($stature1 != 0) $where1 = $where1." and stature >= ".$stature1." ";
if($stature2 != 0) $where1 = $where1." and stature <= ".$stature2." ";
if($sch_end != 0) $where1 = $where1." and sch_end >= ".$sch_end." ";
if($job_money != 0) $where1 = $where1." and job_money >= ".$job_money." ";
if($job != 0) $where1 = $where1." and job = ".$job." ";
if($smoking != 0) $where1 = $where1." and smoking = ".$smoking." ";
if($religion != 0) $where1 = $where1." and religion = ".$religion." ";
if($caru != 0) $where1 = $where1." and caru = ".$caru." ";
if($mb_addr1) $where1 = $where1." and mb_addr1 like '".$mb_addr1."%' ";

$sql_search .= $where1;
/*
if ($is_admin != 'super')
    $sql_search .= " and mb_level <= 3 and mb_level > 1 ";

if (!$sst) {
    $sst = "mb_datetime";
    $sod = "desc";
}
*/
//$sql_order = " order by $sst $sod ";

$sql = " select count(*) as cnt
         $sql_common
         $sql_search";
         //$sql_order ";
$row = sql_fetch($sql);
$total_count = $row[cnt];

$rows = $config[cf_page_rows];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$sql = " select *
          $sql_common
          $sql_search
          $sql_order
          limit $from_record, $rows ";
$result = sql_query($sql);

이렇게 list.skin.php 에 달아봤는데 전혀 검색이 안되는데

어떤식으로 해야 할까요?

  • 복사

댓글 전체

bbs/list.php 에서

71번줄
if ($sca || $stx) 
{
    $sql = " select * from $write_table where wr_id>0 $sql_search $sql_order limit $from_record, $board[bo_page_rows]";
}
else
{
    $sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}

이 부분위에 이름 input name="dname" 라면

if($dname){
    $sql_search .= " and dname='$dname'";
}
이런식으로 쿼리 넣어주시고
if ($sca || $stx) 
이부분에
if ($sca || $stx || $dname) 
이런식으로 추가 해주시면 됩니다.
© SIRSOFT
현재 페이지 제일 처음으로