itemformupdate 에러 ... 채택완료
안녕하세요
기존에 게시판에서 사용하던 다음 api를 상품등록과 연동했습니다.
db에서 it_loca라는 칼럼을 추가했고
itemform.php 에서
</p>
<p>// 주소입력</p>
<p>$it_loca= explode('|',$it['it_loca']);</p>
<p>$ex_zip = $it_loca[0];</p>
<p>$ex_addr1 = $it_loca[1];</p>
<p>$ex_addr2 = $it_loca[2];</p>
<p>$ex_addr3 = $it_loca[3];</p>
<p>$ex_jibeon = $it_loca[4];</p>
<p> </p>
<p><label for="ex_zip" class="sound_only">우편번호</label></p>
<p> <input type="text" name="ex_zip" value="<?php echo $ex_zip; ?>" id="ex_zip" class="frm_input" size="6" maxlength="6"></p>
<p> <button type="button" class="btn_frmline" onclick="win_zip('fitemform', 'ex_zip', 'ex_addr1', 'ex_addr2', 'ex_addr3', 'ex_jibeon');">주소 검색</button>
</p>
<p> <input type="text" name="ex_addr1" value="<?php echo $ex_addr1; ?>" id="ex_addr1" class="info_input frm_address" size="50"></p>
<p> <label for="ex_addr1">기본주소</label>
</p>
<p> <input type="hidden" name="ex_addr2" value="<?php echo " ".$ex_addr2; ?>" id="ex_addr2" class="info_input frm_address" size="50"></p>
<p> <!--<label for="ex_addr2">상세주소</label>--></p>
<p> </p>
<p> </p>
<p> <input type="text" name="ex_addr3" value="<?php echo $ex_addr3; ?>" id="ex_addr3" class="info_input frm_address" size="50" readonly="readonly"></p>
<p> <label for="ex_addr3">참고항목</label></p>
<p> <input type="hidden" name="ex_jibeon" value="<?php echo $ex_jibeon; ?>"></p>
<p>
로 처리한 후에
itemformupdate.php에서
$sql_common에
it_loca = '$it_loca',
추가한거로는 db로 업데이트 되지 않아서
</p>
<p>//위치 업데이트</p>
<p>$lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";</p>
<p>$sql_loca = "update g5_shop_item set it_loca = '$lt_loca' where it_id = '$it_id'";</p>
<p>sql_query($sql_loca);</p>
<p>
로 처리했습니다.
echo $sql_loca;
exit();
update g5_shop_item set it_loca = '07327|서울 영등포구 국제금융로 20| | (여의도동, 율촌빌딩)|R' where it_id = '1644557182'
라고 출력됩니다. 에러는 없는거 같아 보였는데
상품 뷰페이지에서도 연동은 잘 되구요
근데...
주소를 업데이트하는 쿼리를 치면
다른것들이 수정이 안됩니다ㅠㅠ
상품명부터 해서 모든 수정한 글들이 update 되지 않는데
뭐가 문제일까요... 고수님들 답변 부탁드립니다ㅠㅠ
답변 3개
근데...
주소를 업데이트하는 쿼리를 치면
다른것들이 수정이 안됩니다ㅠㅠ
상품명부터 해서 모든 수정한 글들이 update 되지 않는데
이부분을 좀 코드로 보여주세요
답변에 대한 댓글 5개
그 업데이트문 쿼리에다가 $lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
it_loca = '$lt_loca' << 사이에 집어 넣으면 되지 않아요?
이외 모든것들이 수정이 불가능해집니다ㅠㅠ
==
그렇다는 것은 it_loca를 위한 부분은 문제가 없고
원래 있던 부분에 문제가 생겼다는 것이네요.
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번째 줄에 가보니
이미지 파일첨부 부분 에러라고 뜨는데.. 제가 잘못된곳에 선언한건가요?
이부분 위에 또 $sql_common 이 없나요? 그부분 넣어주세요
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
코드상으로는 문제가 없어 보입니다만, 변수를 모두 감싸주시거나 분리하신 후 테스트 해보시는 게 어떠실런지요
답변에 대한 댓글 2개
$lt_loca = "$ex_zip|$ex_addr1|$ex_addr2|$ex_addr3|$ex_jibeon";
이렇게 감싸는거 말고 다른 방법이 있나요??
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
//위치 업데이트
$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 값은 들어오지만
이외 모든것들이 수정이 불가능해집니다ㅠㅠ