선착순 댓글이며, 동시에 신청하기 버튼을 눌렀을 경우 가장 빨리 작성한 사람 댓글만 남고
다른 사람은 신청이 실패하였다고 뜨고 메인으로 이동합니다.
Copy
// 우선예약자 체크
$mb_id = $member['mb_id']; // g5_write_xxx 필드에 mb_id가 있어서 없어도 무방한듯
$sql = " select count(*) as cnt from $write_table
where wr_parent = '$wr_id' and wr_is_comment ='1'";
$row = sql_fetch($sql);
$sql2 = " delete from $write_table where wr_is_comment ='1' and wr_id = '$comment_id' ";
//echo $sql; exit;
//echo $sql2; exit;
if ($row['cnt'] > "1" && !$is_admin){
if(!$member['mb_level'] == 9){
sql_query($sql2); //작성한 댓글 삭제
sql_query(" update {$write_table} set wr_comment = wr_comment - 1, wr_last = '{$row['wr_last']}' where wr_id = '{$write['wr_parent']}' ");
alert('신청이 실패하었습니다.고객센터로 문의바랍니다.','/index.php');
exit;
}
}
이렇게 작성해서 원글 코멘트 수까지 감소되게 설정했는데
문제는 new.php에 본인 작성글을 확인하면 코멘트 내용이 확인되네요.....
new.php에 업데이트가 안되게 하려면 어떻게 해야하나요 ?
답변 1개
채택된 답변
+20 포인트
eyekiss
4년 전
아래 소스를 추가해서 new 테이블에서도 삭제해주면 됩니다.
Copy
$sql3 = " delete from {$g5['board_new_table']} where bo_table='$bo_table' and wr_id = '$comment_id' ";
sql_query($sql3);
답변을 작성하려면 로그인이 필요합니다.