검색 시 회원 이름으로 검색하기

검색 시 회원 이름으로 검색하기

QA

검색 시 회원 이름으로 검색하기

본문


   <!-- 게시판 검색 시작 { -->
    <fieldset id="bo_sch">
        <legend>게시물 검색</legend>
            <form name="fsearch" method="get">
   <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
   <input type="hidden" name="sca" value="<?php echo $sca ?>">
   <input type="hidden" name="sop" value="and">
   <label for="sfl" class="sound_only">검색대상</label>
   <input type="hidden" name="sfl" value="mb_id"<?php echo get_selected($sfl, 'mb_id'); ?>>
   <label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
   <input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="frm_input required" size="15" maxlength="20">
   <input type="submit" value="검색" class="btn_submit">
   </form>
    </fieldset>
    <script type="text/javascript">
        $('#sfl').fancySelect();
    </script>
    <!-- } 게시판 검색 끝 -->

 

위와 같은 소스가 있는데 현재 mb_id로 검색되는걸 mb_name 필드로 검색되도록 바꾸고 싶습니다.. 혹시 어떤걸 변경해야 되는걸까요?

 

그리고 아래는 그렇게 검색된 사용자의 제목별 글 작성 횟수를 카운트하는건데

 

현재는 제가 쓴 글이 카운트되는데 검색된 사용자의 횟수를 카운트하고 싶습니다.

 

이것도 어떤 소스를 추가하면 될 지 방법 알려주시면 감사드리겠습니다!

 



 <!-- 제목별 카운트 -->
 <div class="tbl_head01 tbl_wrap">
  <table>
        <thead>
   <tr>
   <th style="text-align:center" width="80%">항목</th>
   <th style="text-align:center" width="20%">횟수</th>
  </tr>
  <?php for($i=0; $row=sql_fetch_array($result); $i++){ ?>
   <tr>
    <td><?php echo $row['wr_subject'] //제목 ?></td>
    <td style="text-align:center"><?php echo $row['cnt'] //카운트 ?></td>
   </tr>
  <?php } ?>
  </table>
  </thead>
    </div>
<!-- 제목별 카운트 끝 -->

 

이 질문에 댓글 쓰기 :

답변 2

첫번째것만..

 

위의 코드가 어느것인지 모르겠지만,  5.4버전에서는 글쓴이로 검색하는 것이 있습니다.

 

thumb-2038410394_1601593209.5792_730x300.png

 

글쓴이는  wr_name으로 검색됩니다.

https://github.com/gnuboard/gnuboard5/blob/1600f63dee8fc14562c51b2544d9b6fa043efbb0/lib/get_data.lib.php#L451

 

이름은 실명과 닉네임이 있는 데 이것은 게시판 관리에서 

 

이름(실명) 사용 부분을 체크하시면 됩니다.

아무리해도 잘 안되시면...

 

/lib/common.lib.php

에서

                case "wr_name" :

                //   $str .= " $field[$k] = '$s[$i]' ";  일부 이름으로 검색 가능하도록 수정

                    $str .= " $field[$k] like '%$s[$i]%' ";
                    break;

와 같이 수정하면 글쓴이 이름 일부로도 검색이 가능합니다. 

답변을 작성하시기 전에 로그인 해주세요.
전체 59
QA 내용 검색

회원로그인

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