전체 포인트 말고 월별 포인트로 하고 싶습니다. 채택완료

전체 포인트로 백분율을 구하는걸 월별 포인트로 백분율 구하고 싶습니다.


Copy
<?php$nowdate = date("Y-m",time()); // 이번달//$nowdate = date("Y-m-d",time()); // 이번일$sYear = substr($nowdate, 0, 4)."년";$sMonth = substr($nowdate,5,2)."월";//$sDay = substr($nowdate,8,2)."일";$sql = "SELECT * , COUNT(B.mb_id ) AS count, SUM( B.po_point ) AS pointFROM  $g4[member_table] as ALEFT JOIN $g4[point_table] as B ON ( A.mb_id = B.mb_id AND A.mb_level < 11 AND A.mb_point >= 1) where date_format(B.po_datetime,'%Y-%m') = '$nowdate' group by B.mb_id order by point desc LIMIT 0, 100 ";$result = sql_query($sql);?>



검색해서 찾은건데 월별 구하는거 같고 


Copy
<?php// 전체회원수$mbcnt_all_po = sql_fetch("select count(mb_id) as cnt from `$g4[member_table]`");$sql_common = " and mb_id != '' ";if ($mb['mb_id']) {    $sql = " select count(mb_id) as cnt from {$g4[member_table]} where mb_point > '{$view_point}' {$sql_common} order by mb_point desc ";    $row = sql_fetch($sql);    $percent_cnt_po = intval(1 *$row['cnt']) / intval(1 * $mbcnt_all_po['cnt']) * 100;    $percent_po_ct = round($percent_cnt_po, 0); // 반올림    $percent_po = $percent_po_ct;}echo $percent_po;?>


이건 전체 포인트 백분율 구하는거 입니다.


제가 초보라 어떻게 이 두개를 어떻게 합쳐야 될지 잘 모르겠습니다.

답변 1개

채택된 답변
+20 포인트

배추빌더에 포인트랭킹 참조하시면될듯

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

잘 안되네요 ㅠㅠ

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

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고