선착순 예약 게시판을 만들고 있는데요.
하루에 신청이 가능한 예약은 총 2개이며, 하나의 게시글에는 한번만 달 수 있게 하고싶습니다.
현재 상태는 한게시판에 하나의 댓글만 쓸수 있도록 되어있습니다.
하루동안 2개의 댓글만을 쓸 수 있도록 하려면 어떻게 해야하나요?
Copy
<?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 } ?>
Copy
function res_notice() {
alert("이미 신청서를 작성하셨습니다.");
$(".res_btn").attr('onclick', '').unbind('click');
window.location.reload();
}
|
답변 3개 / 댓글 2개
채택된 답변
+20 포인트
4년 전
$result['cnt'] > 0
=>
$result['cnt'] > 1
답변에 대한 댓글 2개
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 다르면 새글을 체크
Copy
<?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 } ?>
4년 전
게시판의 댓글을 오늘 날짜 기준으로 wr_datetime으로 해서 내 아이디로 오늘 날짜 기준으로 몇개 등록되었는지 체크를 넣어서 처리해 주시면 될듯 한데요
그리고 등록버튼만 제어하기 보다는 등록시에도 한번더 체크를 넣어주시는게 좋을겁니다.
답변을 작성하려면 로그인이 필요합니다.