게시물 당 댓글 허용 수 1인 1개로 제한할 수 있을까요??
본문
<?php
$result = sql_fetch(" select count(*) as cnt from $write_table where wr_is_comment='1' and wr_parent='$view[wr_id]' and mb_id='$member[mb_id]'");
if($result['cnt']<"1") {
?>
<div class="res_btn">신청서 작성</button>
<?php } ?>
이미 댓글을 달았을 때 버튼이 안보이는게 아니라
이미 댓글을 달았다면 버튼 클릭시 alert 창이 보이게 하고싶은데 어떻게 해야할까요?
!-->답변 1
<?php
$result = sql_fetch(" select count(*) as cnt from $write_table where wr_is_comment='1' and wr_parent='$view[wr_id]' and mb_id='$member[mb_id]'");
$addEvent = ($result['cnt'] > 0) ? 'onclick="alert(\'신청서를 이미작성하셨습니다.\'); event.stopPropagation();"' : '';
?>
<div class="res_btn" <?php echo $addEvent; ?>>신청서 작성</button>
답변을 작성하시기 전에 로그인 해주세요.