우선 요것은 전체상품 또는 일부 상품 카테고리를 기준으로
상품명을 검색해서 해당 검색된 상품의 카테고리를 일괄 변경하려고 하는 쿼리문입니다. ㅠ
Copy
// 상품명 기준 카테고리 일괄 변경 시작if($replace_caid) { if($sca) { $where = "where ca_id = '$sca'"; } //분류 로드$ca_list = '<option value="">선택</option>'.PHP_EOL;$sql = " select * from {$g5['g5_shop_category_table']} ";if ($is_admin != 'super') $sql .= " where ca_mb_id = '{$member['mb_id']}' ";$sql .= " order by ca_order, ca_id ";$result = sql_query($sql);for ($i=0; $row=sql_fetch_array($result); $i++){ $len = strlen($row['ca_id']) / 2 - 1; $nbsp = ''; for ($i=0; $i<$len; $i++) { $nbsp .= ' '; } $ca_list .= '<option value="'.$row['ca_id'].'">'.$nbsp.$row['ca_name'].'</option>'.PHP_EOL;}//분류 로드 끝 $sql2 = "update g5_shop_item set ca_id = $ca_list where it_name like '%$reptxt%' $where"; sql_query($sql2);}// 상품명 기준 카테고리 일괄 변경 끝
이렇게 쿼리문을 설정해서
Copy
상품명 <input type="text" name="reptxt" id="stx" class="frm_input" value="<?php echo $reptxt; ?>">을(를) <select name="replace_caid" id="stx" style="height:25px" class="frm_input" value="<?php echo $replace_caid; ?>"> <?php echo $ca_list; ?> </select> 으로 <input type="submit" value="변경하기" class="btn_submit">
요렇게 했는데요.
안되네요 ㅡㅡㅎ
(뻘쭘하게.. 긁적긁적)
어디가 잘 못 된건지 30분째 도전해봐도 안되네요.
고수님들의 날카로운 지적 부탁드립니다. :D
|
답변 1개
채택된 답변
+20 포인트
9년 전
$sql2 = "update g5_shop_item set ca_id = $ca_list where it_name like '%$reptxt%' $where";
이부분을 프린트에서 직접 커리를 해보세요
답변을 작성하려면 로그인이 필요합니다.