sql 조건문 이거 잘못 썼나요?

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
sql 조건문 이거 잘못 썼나요?

QA

sql 조건문 이거 잘못 썼나요?

답변 1

본문

우선 요것은 전체상품 또는 일부 상품 카테고리를 기준으로

상품명을 검색해서 해당 검색된 상품의 카테고리를 일괄 변경하려고 하는 쿼리문입니다. ㅠ

 


// 상품명 기준 카테고리 일괄 변경 시작
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);
}
// 상품명 기준 카테고리 일괄 변경 끝

 

이렇게 쿼리문을 설정해서

 


상품명 <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

답변을 작성하시기 전에 로그인 해주세요.
전체 2
© SIRSOFT
현재 페이지 제일 처음으로