레벨업 함수인데요 레벨이 1증가도 안하고 랜덤으로 증가하구요

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
레벨업 함수인데요 레벨이 1증가도 안하고 랜덤으로 증가하구요

QA

레벨업 함수인데요 레벨이 1증가도 안하고 랜덤으로 증가하구요

답변 1

본문


 
function gainEXP($email,$gain){
    global $con;
    $query = "select * from t1_members where email='$email' limit 1";
    $result = mysqli_query ($con, $query);
    $rows = mysqli_fetch_array($result);
    //print_r2($rows);
    //echo $rows['exp'];    
    $Exp = 0;
    $MaxExp = 0;
    $Remain = 0;
    $Exp = (double)$rows['exp'];
    $MaxExp = (double)$rows['maxExp'];
    $Remain = (double)$rows['remain'];
    $Exp += (double)$gain;
    
    if($Exp >= $MaxExp){
        $Remain = $Exp - $MaxExp;  //remain 1레벨 총량
        LevelUp($email,$Remain);
    }
    
    $sql = "update t1_members set exp='$Exp', maxExp='$MaxExp', remain='$Remain' where email='$email'";
    //alert($sql);
    
    $row = mysqli_query($con,$sql);
    //mysqli_error();
    //die( "mysqli connect error : " . mysqli_error() );
}

function LevelUp($email, $remainingEXP){
    global $con;
    //alert($remainingEXP);
    $query = "select * from t1_members where email='$email' limit 1";
    $result = mysqli_query ($con,$query);
    $rows = mysqli_fetch_array($result);
    $Exp = 0;
    $MaxExp = 0;
    $Remain = 0;
    $Level = 0;
    
    $Exp = (double)$rows['exp'];
    $MaxExp = (double)$rows['maxExp'];
    $Remain = (double)$rows['remain'];
    $Level = (double)$rows['level'];
    if($Level===0){
        $Level=1;
    }    
    $Exp += (double)$remainingEXP;
    $Level++;
    $MaxExp = (double)(125 * $MaxExp)/100;
    $sql = "update t1_members set level ='$Level', exp='$Exp', maxExp='$MaxExp', remain='$Remain' where email='$email'";
    $row = mysqli_query($con, $sql);    
    gainEXP($email,0);
    //die( "mysqli connect error : " . mysqli_error() );
}
 
 

 

레벨업 함수인데요 레벨이 1증가도 안하고 랜덤으로 증가하구요

레벨업하면 다시 경험치가 0이 되어야 하는데 안되고 아주 과관이네요 이거 하면 할수록 멘붕오네요

캐싱되어서 웹사이트가 멍청이가 된걸까요?? php가 시대 흐름에 역행하는 기분은 머지 아 멘붕

 

레벨업 잘되는지 봐주실 고수님들 도와주세요  double 형 입니다.

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 0
© SIRSOFT
현재 페이지 제일 처음으로