회원 일간,주간,월간 포인트 회득량 구하기
[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년 전 | 4435 | ||
| 2334 | 2년 전 | 3698 | ||
| 2333 | 2년 전 | 2065 | ||
| 2332 |
swallow
|
2년 전 | 1424 | |
| 2331 | 2년 전 | 2505 | ||
| 2330 | 2년 전 | 3448 | ||
| 2329 |
welcome
|
2년 전 | 2128 | |
| 2328 | 2년 전 | 1506 | ||
| 2327 |
|
2년 전 | 2195 | |
| 2326 | 2년 전 | 1344 | ||
| 2325 | 2년 전 | 2154 | ||
| 2324 | 2년 전 | 1629 | ||
| 2323 |
희동이76
|
2년 전 | 1400 | |
| 2322 | 2년 전 | 2199 | ||
| 2321 | 2년 전 | 1739 | ||
| 2320 |
희동이76
|
2년 전 | 1388 | |
| 2319 | 2년 전 | 2192 | ||
| 2318 |
슈퍼스타맨
|
2년 전 | 1822 | |
| 2317 | 2년 전 | 1490 | ||
| 2316 | 2년 전 | 1968 | ||
| 2315 | 2년 전 | 1769 | ||
| 2314 | 2년 전 | 1275 | ||
| 2313 | 2년 전 | 1461 | ||
| 2312 | 2년 전 | 2496 | ||
| 2311 | 2년 전 | 1715 | ||
| 2310 | 2년 전 | 1715 | ||
| 2309 | 2년 전 | 3343 | ||
| 2308 | 2년 전 | 1026 | ||
| 2307 | 2년 전 | 1621 | ||
| 2306 |
디지털홍익인간
|
2년 전 | 2509 | |
| 2305 | 2년 전 | 1904 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기