회원 일간,주간,월간 포인트 회득량 구하기
[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년 전 | 4402 | ||
| 2364 | 1년 전 | 1634 | ||
| 2363 | 1년 전 | 2106 | ||
| 2362 |
디지털홍익인간
|
1년 전 | 1254 | |
| 2361 | 1년 전 | 2033 | ||
| 2360 |
parkee
|
1년 전 | 929 | |
| 2359 | 1년 전 | 1653 | ||
| 2358 | 1년 전 | 1379 | ||
| 2357 | 2년 전 | 2651 | ||
| 2356 | 2년 전 | 1651 | ||
| 2355 |
타버린나무
|
2년 전 | 1858 | |
| 2354 | 2년 전 | 2386 | ||
| 2353 |
swallow
|
2년 전 | 2362 | |
| 2352 | 2년 전 | 1510 | ||
| 2351 | 2년 전 | 1592 | ||
| 2350 |
|
2년 전 | 1477 | |
| 2349 | 2년 전 | 1291 | ||
| 2348 | 2년 전 | 2378 | ||
| 2347 | 2년 전 | 2493 | ||
| 2346 |
ceramoon
|
2년 전 | 1532 | |
| 2345 | 2년 전 | 1274 | ||
| 2344 | 2년 전 | 1678 | ||
| 2343 | 2년 전 | 2407 | ||
| 2342 | 2년 전 | 1645 | ||
| 2341 | 2년 전 | 1177 | ||
| 2340 | 2년 전 | 2529 | ||
| 2339 | 2년 전 | 1221 | ||
| 2338 | 2년 전 | 1398 | ||
| 2337 | 2년 전 | 1709 | ||
| 2336 | 2년 전 | 2002 | ||
| 2335 | 2년 전 | 2279 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기