한 게시글에 댓글 한개, 전체 게시글에 하루에 댓글 두개로 제한하기. 채택완료
굼떠
4년 전
조회 1,483
선착순 예약 게시판을 만들고 있는데요.
하루에 신청이 가능한 예약은 총 2개이며, 하나의 게시글에는 한번만 달 수 있게 하고싶습니다.
현재 상태는 한게시판에 하나의 댓글만 쓸수 있도록 되어있습니다.
하루동안 2개의 댓글만을 쓸 수 있도록 하려면 어떻게 해야하나요?
</p>
<p><?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="res_notice()"' : '' ;
?>
<div class="res_btn" <?php echo $addEvent; ?> <?php echo $cmt_member; ?> style="cursor:pointer;">접수하기</div>
<?php } ?></p>
<p>
</p>
<p>function res_notice() {
alert("이미 신청서를 작성하셨습니다.");
$(".res_btn").attr('onclick', '').unbind('click');
window.location.reload();
}</p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
채택된 답변
+20 포인트
답변에 대한 댓글 2개
�
굼떠
4년 전
댓글 감사합니다. 말씀하신대로 수정하게되면, 댓글이 두개로 제한은 되나 한 게시판에 두개의 댓글을 달 수도 있네여 ㅠㅠ
�
트샷
4년 전
$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]'");
->
$result = sql_fetch(" select count(*) as cnt from $write_table where wr_is_comment='1' and mb_id='$member[mb_id]'");
->
$result = sql_fetch(" select count(*) as cnt from $write_table where wr_is_comment='1' and mb_id='$member[mb_id]'");
댓글을 작성하려면 로그인이 필요합니다.
4년 전
아래코드로 해보세요 g5_board_new에서 금일 전체 게시판 새 댓글 카운트 wr_id와 wr_parant 다르면 새글을 체크
</p>
<p><?php
$result = sql_fetch(" select count(*) as cnt from g5_board_new where bn_datetime like '".G5_TIME_YMD."%' and mb_id='".$member['mb_id']."' and wr_id!=wr_parant");
$addEvent = ($result['cnt'] > 1) ? 'onclick="res_notice()"' : '' ;
?>
<div class="res_btn" <?php echo $addEvent; ?> <?php echo $cmt_member; ?> style="cursor:pointer;">접수하기</div>
<?php } ?></p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인