[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)?>
게시글 목록
| 번호 | 제목 |
|---|---|
| 23966 | |
| 23963 | |
| 23953 | |
| 23949 | |
| 23938 | |
| 23935 | |
| 23933 | |
| 23928 | |
| 23919 | |
| 23918 | |
| 23917 | |
| 23910 | |
| 23902 | |
| 23901 | |
| 23897 | |
| 23894 | |
| 23893 | |
| 23891 | |
| 23885 | |
| 23872 | |
| 23870 | |
| 23862 | |
| 23859 | |
| 23853 | |
| 23845 | |
| 23838 | |
| 23827 | |
| 23819 | |
| 23805 | |
| 23801 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기