영카트 주문내역리스트에 회원 닉네임 검색을 추가하고싶습니다.
본문
orderlist.php에 회원디비 닉네임 검색을 추가하고싶습니다.
답변 5
/adm/shop_admin/orderlist.php 내용
<?php
$sub_menu = '400400';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g5['title'] = '주문내역';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$where = array();
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
if ($sel_field == 'mb_nick'){
$res = sql_fetch("select mb_id from {$g5['member_table']} where mb_nick like '%".$search."%'");
$where[] = " mb_id = '{$res['mb_id']}' ";
}else{
$where[] = " $sel_field like '%$search%' ";
}
}
if ($save_search != $search) {
$page = 1;
}
}
//이하 생략...
약 140번째줄
<label for="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
<option value="mb_id" <?php echo get_selected($sel_field, 'mb_id'); ?>>회원 ID</option>
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
<option value="mb_nick" <?php echo get_selected($sel_field, 'mb_nick'); ?>>닉네임</option>
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?>>주문자전화</option>
<option value="od_hp" <?php echo get_selected($sel_field, 'od_hp'); ?>>주문자핸드폰</option>
<option value="od_b_name" <?php echo get_selected($sel_field, 'od_b_name'); ?>>받는분</option>
<option value="od_b_tel" <?php echo get_selected($sel_field, 'od_b_tel'); ?>>받는분전화</option>
<option value="od_b_hp" <?php echo get_selected($sel_field, 'od_b_hp'); ?>>받는분핸드폰</option>
<option value="od_deposit_name" <?php echo get_selected($sel_field, 'od_deposit_name'); ?>>입금자</option>
<option value="od_invoice" <?php echo get_selected($sel_field, 'od_invoice'); ?>>운송장번호</option>
</select>
/* 이하 생략 */
!-->!-->
아래와 같이 변형해서 쓰시면 될것 같습니다.
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
if ($sel_field == 'mb_nick'){
$res = sql_query("select mb_id from {$g5['member_table']} where mb_nick like '%".$search."%'");
for($i=0;$iddata=sql_fetch_array($res);$i++){
if($i!=0){ $idwhere .= " or "; }
$idwhere .= " mb_id = '{$iddata['mb_id']}' ";
}
if(mysql_num_rows($res)){
$where[] = $idwhere;
}else{
$where[] = "mb_id = '$search' ";
}
}else{
$where[] = " $sel_field like '%$search%' ";
}
}
if ($save_search != $search) {
$page = 1;
}
}
감사드립니다. 정말 잘됩니다
닉네임 검색이 풀네임으로만 검색이되고
특정 단어로는 검색이 안되는데 이부분 쿼리문 어떻게 수정해야지 될까요?
감사합니다~~
답변을 작성하시기 전에 로그인 해주세요.