게시판 이동시 업데이트 할때 추가 작업하려고 합니다. 채택완료
게시판 이동시 wr_17필드에 신규라고 되어있으면, 두 개의 테이블에 wr_17을 기존이라고 update 바꾸려고 하는데 반응이 없어서요..이동하는데에는 문제가 없지만, 혹시나 싶어 echo로 wr_id,code,wr_subject,sca를 출력해보니까 선택한 것에 대해 제대로 나오긴 하거든요..
무엇이 잘못 되었을까요??ㅠㅠ
$wr_id = $_GET['wr_id']; $wr_subject = $_GET['wr_subject']; $code = $_GET['code']; $sca = $_GET['sca'];
$res2 = sql_fetch("select * from g5_write_bbt_ext where wr_subject = '$wr_subject' and ca_name='$sca'"); if($res2['wr_17'] == "신규") {
$add_wr_17 = "기존";
$sql2 = " update g5_write_cam_list set wr_17 = '$add_wr_17' //echo로 찍으면 값이 정상적으로 나옵니다. where code='{$code}' and wr_subject='{$wr_subject}' and ca_name='{$sca}'"; sql_query($sql2); //업데이트할 1번째 테이블
$sql3 = " update g5_write_FIXTURE set wr_17 = '$add_wr_17' where code='{$code}' and wr_subject='{$wr_subject}' and ca_name='{$sca}'"; sql_query($sql3); //업데이트할 2번째 테이블
}
답변 2개
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
업데이트가 안되면 어떠한 이유때문에 안되는것이죠.
sql_query($sql2, true); 이렇게 해서 에러가 나는지 확인해보셔야죠.
아래코드처럼 해서 에러가 나는지 안나는지부터 확인해보세요.
</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;">$wr_id = $_GET['wr_id'];
$wr_subject = $_GET['wr_subject'];
$code = $_GET['code'];
$sca = $_GET['sca']; </p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;"> </p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;">$res2 = sql_fetch("select * from g5_write_bbt_ext where wr_subject = '$wr_subject' and ca_name='$sca'");
if($res2['wr_17'] == "신규") {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;">$add_wr_17 = "기존";</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;"><span style="color: rgb(255, 0, 0);">$sql2 = " update g5_write_cam_list set </span>
<span style="color: rgb(255, 0, 0);"> wr_17 = '$add_wr_17' //echo로 찍으면 값이 정상적으로 나옵니다.</span>
<span style="color: rgb(255, 0, 0);"> where code='{$code}' and wr_subject='{$wr_subject}' and ca_name='{$sca}'";</span>
<span style="color: rgb(255, 0, 0);">sql_query($sql2, true); //업데이트할 1번째 테이블</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;"><span style="color: rgb(0, 117, 200);">$sql3 = " update g5_write_FIXTURE set </span>
<span style="color: rgb(0, 117, 200);"> wr_17 = '$add_wr_17'</span>
<span style="color: rgb(0, 117, 200);"> where code='{$code}' and wr_subject='{$wr_subject}' and ca_name='{$sca}'";</span>
<span style="color: rgb(0, 117, 200);">sql_query($sql3, true); </span><span style="color: rgb(0, 117, 200);">//업데이트할 2번째 테이블</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;"><span style="color: rgb(0, 117, 200);"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;"><span style="color: rgb(0, 117, 200);">exit;</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;">}</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px;">
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
나오는데 update가 안되요..