itemformupdate 에러 ...

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
itemformupdate 에러 ...

QA

itemformupdate 에러 ...

본문

안녕하세요

기존에 게시판에서 사용하던 다음 api를 상품등록과 연동했습니다.

db에서 it_loca라는 칼럼을 추가했고

 

itemform.php 에서


// 주소입력
$it_loca= explode('|',$it['it_loca']);
$ex_zip  = $it_loca[0];
$ex_addr1  = $it_loca[1];
$ex_addr2  = $it_loca[2];
$ex_addr3  = $it_loca[3];
$ex_jibeon  = $it_loca[4];
 
<label for="ex_zip" class="sound_only">우편번호</label>
                        <input type="text" name="ex_zip" value="<?php echo $ex_zip; ?>" id="ex_zip"  class="frm_input" size="6" maxlength="6">
                        <button type="button" class="btn_frmline" onclick="win_zip('fitemform', 'ex_zip', 'ex_addr1', 'ex_addr2', 'ex_addr3', 'ex_jibeon');">주소 검색</button><br>
                        <input type="text" name="ex_addr1" value="<?php echo $ex_addr1; ?>" id="ex_addr1" class="info_input frm_address" size="50">
                        <label for="ex_addr1">기본주소</label><br>
                        <input type="hidden" name="ex_addr2" value="<?php echo " ".$ex_addr2; ?>" id="ex_addr2" class="info_input frm_address" size="50">
                        <!--<label for="ex_addr2">상세주소</label>-->
           
           
                        <input type="text" name="ex_addr3" value="<?php echo $ex_addr3; ?>" id="ex_addr3" class="info_input frm_address" size="50" readonly="readonly">
                        <label for="ex_addr3">참고항목</label>
                        <input type="hidden" name="ex_jibeon" value="<?php echo $ex_jibeon; ?>">

로 처리한 후에

itemformupdate.php에서

$sql_common에

it_loca                = '$it_loca',

추가한거로는 db로 업데이트 되지 않아서


//위치 업데이트
$lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
$sql_loca = "update g5_shop_item set it_loca = '$lt_loca' where it_id = '$it_id'";
sql_query($sql_loca);

로 처리했습니다.

 

echo $sql_loca;

exit();

 

update g5_shop_item set it_loca = '07327|서울 영등포구 국제금융로 20| | (여의도동, 율촌빌딩)|R' where it_id = '1644557182'

라고 출력됩니다. 에러는 없는거 같아 보였는데

 

상품 뷰페이지에서도 연동은 잘 되구요

근데...

주소를 업데이트하는 쿼리를 치면

다른것들이 수정이 안됩니다ㅠㅠ

상품명부터 해서 모든 수정한 글들이 update 되지 않는데

뭐가 문제일까요... 고수님들 답변 부탁드립니다ㅠㅠ

이 질문에 댓글 쓰기 :

답변 3

근데...

주소를 업데이트하는 쿼리를 치면

다른것들이 수정이 안됩니다ㅠㅠ

상품명부터 해서 모든 수정한 글들이 update 되지 않는데

 

이부분을 좀 코드로 보여주세요

본문에 있습니다..!

//위치 업데이트
$lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
$sql_loca = "update g5_shop_item set it_loca = '$lt_loca' where it_id = '$it_id'";
sql_query($sql_loca);

itemformupdate.php에 이 코드를 넣으면 db에 it_loca 값은 들어오지만
이외 모든것들이 수정이 불가능해집니다ㅠㅠ

음.. 일단 업데이트쿼리 보면 모든거 집어 넣은 쿼리 문구를 넣어주시고
그 업데이트문 쿼리에다가 $lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
it_loca = '$lt_loca' << 사이에 집어 넣으면 되지 않아요?

itemformupdate.php에 이 코드를 넣으면 db에 it_loca 값은 들어오지만
이외 모든것들이 수정이 불가능해집니다ㅠㅠ
==
그렇다는 것은 it_loca를 위한 부분은 문제가 없고
원래 있던  부분에 문제가 생겼다는 것이네요.

sql_query( $sql, TRUE); exit; // 해서 에러 메시지를 확인해 보세요.

sql_query( $sql, TRUE); exit;를 어디다 선언해야할지 잘 모르겠어서
기존에 있던거에서
이부분에 선언했는데
else if ($w == "u") {
$sql_common .= " , it_update_time = '".G5_TIME_YMDHIS."' ";
    $sql = " update {$g5['g5_shop_item_table']}
                set $sql_common
              where it_id = '$it_id' ";
//sql_query($sql);
    sql_query( $sql, TRUE); exit;
}

1064 : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' it_update_time = '2022-03-15 09:00:51' where it_id = '1646723275' at line 121

라는 에러가 뜹니다.
121번째 줄에 가보니
이미지 파일첨부 부분 에러라고 뜨는데.. 제가 잘못된곳에 선언한건가요?

코드상으로는 문제가 없어 보입니다만, 변수를 모두 감싸주시거나 분리하신 후 테스트 해보시는 게 어떠실런지요

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

회원로그인

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