레벨이 다 똑같이 나와요
본문
아래 식으로 했더니 레벨 아이콘이 모두 같은 아이콘으로 나옵니다.. 어떻게해야되나요?
<?php
include_once("_common.php");
@include_once("$g4[path]/lib/mw.builder.lib.php");
$g4[title] = "포인트순위";
include_once("_head.php");
$sql_common = " from $g4[member_table] ";
$sql_where = " where mb_id <> '$config[cf_admin]' and mb_level > 1 and mb_leave_date = '' and mb_intercept_date = '' ";
$sql_order = " order by mb_point desc";
$sql = "select sum(mb_point) as total_point
$sql_common
$sql_where";
$row = sql_fetch($sql);
$total_point = number_format($row[total_point]);
$sql = "select count(*) as cnt
$sql_common
$sql_where
and mb_point > '$member[mb_point]'";
$row = sql_fetch($sql);
$my_rank = $row[cnt] + 1;
$sql = "select count(*) as cnt
$sql_common
$sql_where";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$page = "";
$rows = 100;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = "select mb_id, mb_name, mb_nick, mb_email, mb_homepage, mb_point
$sql_common
$sql_where
$sql_order
limit $from_record, $rows";
$qry = sql_query($sql);
$list = array();
for ($i=0; $row=sql_fetch_array($qry); $i++) {
$list[$i][rank] = number_format((($page - 1) * $rows) + $i + 1);
$list[$i][name] = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email]. $row[mb_homepage]);
$list[$i][point] = number_format($row[mb_point]);
}
$list_count = sizeof($list);
//$paging = get_paging($rows, $page, $total_page, "?page=");
?>
<script type="text/javascript" src="<?=$g4[path]?>/js/sideview.js"></script>
<style type="text/css">
.info { height:25px; margin:0 0 0 10px; font-size:13px; }
.line { border-top:1px solid #ddd; margin:10px 0 10px 0; }
.point-ranking { }
.point-ranking .head { font-weight:bold; text-align:center; height:30px }
.point-ranking .body { height:30px; padding:0; }
.point-ranking .body .rank { width:50px; text-align:right; }
.point-ranking .body .name { width:150px; text-align:left; padding-left:5px; }
.point-ranking .body .point { width:100px; text-align:right; }
.paging { clear:both; height:50px; text-align:center; margin:30px 0 0 0; }
</style>
<?
if ($is_member) {
echo "<div class='info'>· 현재 회원님의 포인트는 <strong>".number_format($member[mb_point])."</strong>점 이며, 순위는 <strong>{$my_rank}</strong>등 입니다.</div>";
echo "<div class='info'>· 전체 포인트 : <strong>{$total_point}</strong>점</div>";
}
?>
<div class="line"></div>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width="50%" valign="top">
<table border=0 cellpadding=0 cellspacing=0 class="point-ranking">
<? for ($i=0; $i<$rows/2 && $i<$list_count; $i++) { ?>
<tr>
<td class="body"> <div class="rank"><?=$list[$i][rank]?>.</div>
<?php include_once G5_LIB_PATH."/level_icon.lib.php"; echo get_level_icon($check['mb_id']);?>
</td>
<td class="body"> <div class="name"><?=$list[$i][name]?></div> </td>
<td class="body"> <div class="point"><?=$list[$i][point]?> 점</div> </td>
</tr>
<? } ?>
</table>
</td>
<td width="50%" valign="top">
<table border=0 cellpadding=0 cellspacing=0 class="point-ranking">
<? for ($i=$rows/2; $i<$list_count; $i++) { ?>
<tr>
<td class="body"> <div class="rank"><?=$list[$i][rank]?>.</div> </td>
<td class="body"> <div class="name"><?=$list[$i][name]?></div> </td>
<td class="body"> <div class="point"><?=$list[$i][point]?> 점</div> </td>
</tr>
<? } ?>
</table>
</td>
</tr>
</table>
<div class="line"></div>
<div class="paging"><?=$paging?></div>
<?
include_once("_tail.php");
?>
답변 2
$check['mb_id']
=>
$list[$i]['mb_id']
이렇게 변경해보세요.
get_level_icon() 에 넘기는 파라미터가 회원 ID 라면,
echo get_level_icon($list[$i]['mb_id']); 로 변경하는 게 맞을 것 같습니다.
변경했을 때 안된다면 하나씩 체크해서,
문제의 원인을 찾아 수정하는 것이 좋습니다.
ex.
1) 특정 ID 로 넘겼을 때, 아이콘 이미지가 달라지는지..
echo get_level_icon('test1');
2) $list[$i]['mb_id'] 는 회원 ID 값이 저장되어 있는 것이 맞는지..
echo $list[$i]['mb_id'];
3) get_level_icon() 함수는 제대로 작동되는 것인지..
..