2026, 새로운 도약을 시작합니다.

추천 하루제한 소스를 만들었는데 안됩니다 ㅠ 채택완료

8년 전 조회 2,703

어느부분이 오류일까요?ㅠㅠ

배우면서 만드는입장이라 어렵게만하네요..

Copy


if ($good == "good") {

            $sql = " select count(*) as cnt from $g5[board_good_table] where bo_table = '$member['mb_id']' and mb_id = '$member[mb_id]' and bg_datetime like '$g5[time_ymd]%' "; 

            $tm1 = sql_fetch($sql);  

            if ($tm1[cnt] >= 5) 

                die("추천은 하루에 5번만 가능합니다."); 

        return;

        }else{

    insert_point($write['mb_id'], '50', $member['mb_nick']."님이 추천", $bo_table, $wr_id, $member['mb_id'].'추천');    

    

    }  

 

 

답변 2개

채택된 답변
+20 포인트
Copy


if ($good == "good") {   

    $sql = " select count(*) as cnt from {$g5['board_good_table']} where bo_table = '{$bo_table}' and mb_id = '{$member['mb_id']}' and substr(bg_datetime,1,10) ='".G5_TIME_YMD."' "; 

    $tm1 = sql_fetch($sql);  

    

    if ($tm1['cnt'] >= 5) 

        alert("추천은 하루에 5번만 가능합니다.");

    else 

        insert_point($write['mb_id'], '50', $member['mb_nick']."님이 추천", $bo_table, $wr_id, $member['mb_id'].'추천');    

}

이렇게 해보세요

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

이거 안되던데
해결하셨나요?

댓글을 작성하려면 로그인이 필요합니다.

bo_table = '$member['mb_id']' and  <-이거때문인거 아닌가요??

자기아이디로 된 게시판에서만 추천 제한하는건 아니실꺼라 보이는데^^;

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

소스를 잘못 적었네요; 아래 소스 입니다.

if ($good == "good") {
$sql = " select count(*) as cnt from $g5[board_good_table] where mb_id = '$member[mb_id]' and bg_datetime like '$g5[time_ymd]%' ";
$tm1 = sql_fetch($sql);
if ($tm1[cnt] >= 5)
die("추천은 하루에 5번만 가능합니다.");
return;
}else{
insert_point($write['mb_id'], '50', $member['mb_nick']."님이 추천", $bo_table, $wr_id, $member['mb_id'].'추천');

}

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고