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

회원 일간,주간,월간 포인트 회득량 구하기

[code]

   // 사용자의 ID
$user_id = $member['mb_id'];

// 현재 날짜와 시간
$current_date = date("Y-m-d H:i:s");

// 일주월 포인트 계산 함수
function calculatePoint($user_id, $dateRange) {
    global $conn;
    
    $sql = "SELECT SUM(po_point) AS total_point FROM g5_point WHERE mb_id = '$user_id' AND po_datetime >= '$dateRange'";
  
    $result = sql_query($sql);
    
    if ($result) {
        $row = sql_fetch_array($result);
        return $row['total_point'];
    } else {
        return 0;
    }
}

// 일주월 포인트 계산
$one_day_ago = date("Y-m-d H:i:s", strtotime("-1 day", strtotime($current_date)));
$one_week_ago = date("Y-m-d H:i:s", strtotime("-1 week", strtotime($current_date)));
$one_month_ago = date("Y-m-d H:i:s", strtotime("-1 month", strtotime($current_date)));

$daily_point = calculatePoint($user_id, $one_day_ago);
$weekly_point = calculatePoint($user_id, $one_week_ago);
$monthly_point = calculatePoint($user_id, $one_month_ago);

[/code]

일:<?=number_format($daily_point)?>

주:<?=number_format($weekly_point)?>

월:<?=number_format($monthly_point)?>

|

댓글 1개

댓글 작성

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

로그인하기

그누보드5 팁자료실

번호 제목 글쓴이 날짜 조회
공지 3년 전 조회 4,596
2741 2일 전 조회 86
2740 3일 전 조회 89
2739 1주 전 조회 200
2738 1주 전 조회 206
2737 1주 전 조회 171
2736 1주 전 조회 274
2735 3주 전 조회 276
2734 3주 전 조회 256
2733 1개월 전 조회 261
2732 1개월 전 조회 297
2731 1개월 전 조회 263
2730 1개월 전 조회 220
2729 1개월 전 조회 349
2728 1개월 전 조회 241
2727 1개월 전 조회 417
2726 1개월 전 조회 250
2725 1개월 전 조회 325
2724 1개월 전 조회 355
2723 1개월 전 조회 263
2722 1개월 전 조회 296
2721 1개월 전 조회 208
2720 2개월 전 조회 301
2719 2개월 전 조회 304
2718 2개월 전 조회 197
2717 2개월 전 조회 333
2716 2개월 전 조회 200
2715 2개월 전 조회 308
2714 2개월 전 조회 269
2713 2개월 전 조회 370
2712 2개월 전 조회 285
🐛 버그신고