100%에서 줄어들기......
몬스터박스
11년 전
조회 7,544
<a href="http://www.monsterbox.co.kr/bbs/board.php?bo_table=mb26&wr_id=2" target="_blank" rel="noopener noreferrer">http://www.monsterbox.co.kr/bbs/board.php?bo_table=mb26&wr_id=2</a> <br />
<br />
아이디 test 비번 test <br />
<br />
주소로 들어가서 결과보기하시면 설문 그래프가 나오는데요...... <br />
총 100%에서 항목별로 그래프가 표시되는데 <br />
이렇게 말고 제일 높은 수치를 무조건 100%로 표기되고 나머지 항목은 수치별로 나타낼 방법이 없을까요? <br />
<br />
아래는 해당 코드입니다. <br />
<br />
<br />
$width = $_GET['width']; <br />
<br />
$width = 900; <br />
<br />
if ($mw_basic[cf_vote]) { <br />
&nbsp; &nbsp; $vote = sql_fetch("select * from $mw[vote_table] where bo_table = '$bo_table' and wr_id = '$wr_id'"); <br />
&nbsp; &nbsp; $vote_list = array(); <br />
<br />
&nbsp; &nbsp; $sql = "select * from $mw[vote_item_table] where vt_id = '$vote[vt_id]'"; <br />
&nbsp; &nbsp; $qry = sql_query($sql); <br />
&nbsp; &nbsp; for ($i=0; $row=sql_fetch_array($qry); $i++) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = @round($row[vt_hit] / $vote[vt_total], 2) * 100; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if ($row[vt_rate]) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = $row[vt_rate]."% (".number_format($row[vt_hit]).") </span>"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = "0"; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_width] = @intval($width * ($row[vt_rate] / 100)); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_item] = cut_str(get_text(strip_tags($row[vt_item])), 50); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vote_list[$i] = $row; <br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; if ($vote[vt_multi]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $qry = sql_query("select count(*) as cnt from $mw[vote_log_table] where vt_id = '$vote[vt_id]' group by mb_id"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vt_total = mysql_num_rows($qry); <br />
&nbsp; &nbsp; } <br />
&nbsp; &nbsp; else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vt_total = $vote[vt_total]; <br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; if ($write[mb_id] == $member[mb_id]) { // 자신의 글은 그냥 출력 <br />
&nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; } else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $is_vote = false; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_sdate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] < $vote[vt_sdate]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } else if ($vote[vt_edate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] > $vote[vt_edate]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } else&nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($is_member) $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and mb_id = '$member[mb_id]'"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and vt_ip = '$_SERVER[REMOTE_ADDR]'"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($row) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; } <br />
} <br />
<br />
$gr = array(); <br />
for ($i=1; $i<=10; $i++) $gr[] = $i; <br />
shuffle($gr); <br />
<br />
$img_path = "$g4[url]/skin/board/$board[bo_skin]/img/"; <br />
<br />
if ($mw_basic[cf_vote] && $vote && sizeof($vote_list)) { <br />
?> <br />
<br />
<br />
<br />
<div class="fs cc h50"></div> <br />
<div class="cc w100p h30 downline"> <br />
<div class="aleft bleft h30 lh34"><img src="<?=$g4[path]?>/img/vote.png" align="absmiddle" style="margin:-4px 6px 0 0;"><span class="fontw b">설문조사</span><span class="date">|</span><?=number_format($vt_total)?>명 참여</div> <br />
<div class="aright bright text11 fonts h30 lh34"><? if ($vote[vt_sdate] != "0000-00-00 00:00:00") echo substr($vote['vt_sdate'],2,2).".".substr($vote['vt_sdate'],5,2).".".substr($vote['vt_sdate'],8,2)." (".get_yoil($vote[vt_sdate]).") ".substr($vote[vt_sdate],11,2)."시 <span class='fontss text11'>-</span> "; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_edate] != "0000-00-00 00:00:00") echo substr($vote['vt_edate'],2,2).".".substr($vote['vt_edate'],5,2).".".substr($vote['vt_edate'],8,2)." (".get_yoil($vote[vt_edate]).") ".substr($vote[vt_edate],11,2)."시 까지"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_point]) echo "<span class='date'>|</span>".number_format($vote[vt_point])."P 지급<span class='date'>|</span>"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_multi]) echo $vote[vt_multi]."개까지 복수선택 가능"; ?><? if ($is_admin) { ?><span class='date'>|</span><a href="#;" onclick="win_open('<?=$board_skin_path?>/proc/vote.list.php?bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>', 'vote_list', 'width=700,height=700,scrollbars=1');"><span class="fontb b text11">참여목록</span></a><? } ?></div> <br />
</div> <br />
<br />
<br />
&nbsp; &nbsp; <? if (!$is_vote && !$result_view) { //--------------------------------설문참여안함?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <div class="cc"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? for ($i=0; $i<sizeof($vote_list); $i++) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h32 lh34 downline bleft"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? if (!$vote[vt_multi]) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="radio" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } else { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="checkbox" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <label for="vt_num_<?=$i?>"><?=$vote_list[$i][vt_item]?></label> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } //for?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h40 bleft" style="margin-top:20px;"><input type="button" value="설문참여" class="btnr w100 cu" onclick="mw_vote_join()"><input type="button" value="결과보기" class="btns cu w100" onclick="mw_vote_result()"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; <? } else { //--------------------------------------설문결과?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <div class="cc"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? for ($i=0; $i<sizeof($vote_list); $i++) { <br />
$line = $i%2; // 홀수,짝수 <br />
if ($line == "1") { $bgline = "#3e0002"; }else{ $bgline = "#4e0003";} ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h32 lh32 downline bleft" > <br />
<div style="position:absoulte;z-index:10;"> <br />
<div class="aleft bleft h30 lh34"><span class="date"></span><?=$vote_list[$i][vt_item]?></div> <br />
<div class="aright bright h30 lh34"><nobr><?=$vote_list[$i][vt_rate]?></nobr><span style="padding-right:6px;"></span></div> <br />
</div> <br />
<br />
<div class="h32" style="background-color:<?=$bgline?>;width:<?=$vote_list[$i][vt_width]?>px;"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } //for?> <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? if ($result_view) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h40 bleft" style="margin-top:20px;"><input type="button" value="설문참여" class="btns w100 cu" onclick="mw_vote_load()"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; <? } ?> <br />
<br />
<? <br />
}
<br />
아이디 test 비번 test <br />
<br />
주소로 들어가서 결과보기하시면 설문 그래프가 나오는데요...... <br />
총 100%에서 항목별로 그래프가 표시되는데 <br />
이렇게 말고 제일 높은 수치를 무조건 100%로 표기되고 나머지 항목은 수치별로 나타낼 방법이 없을까요? <br />
<br />
아래는 해당 코드입니다. <br />
<br />
<br />
$width = $_GET['width']; <br />
<br />
$width = 900; <br />
<br />
if ($mw_basic[cf_vote]) { <br />
&nbsp; &nbsp; $vote = sql_fetch("select * from $mw[vote_table] where bo_table = '$bo_table' and wr_id = '$wr_id'"); <br />
&nbsp; &nbsp; $vote_list = array(); <br />
<br />
&nbsp; &nbsp; $sql = "select * from $mw[vote_item_table] where vt_id = '$vote[vt_id]'"; <br />
&nbsp; &nbsp; $qry = sql_query($sql); <br />
&nbsp; &nbsp; for ($i=0; $row=sql_fetch_array($qry); $i++) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = @round($row[vt_hit] / $vote[vt_total], 2) * 100; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if ($row[vt_rate]) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = $row[vt_rate]."% (".number_format($row[vt_hit]).") </span>"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row[vt_rate] = "0"; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_width] = @intval($width * ($row[vt_rate] / 100)); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $row[vt_item] = cut_str(get_text(strip_tags($row[vt_item])), 50); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vote_list[$i] = $row; <br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; if ($vote[vt_multi]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $qry = sql_query("select count(*) as cnt from $mw[vote_log_table] where vt_id = '$vote[vt_id]' group by mb_id"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vt_total = mysql_num_rows($qry); <br />
&nbsp; &nbsp; } <br />
&nbsp; &nbsp; else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $vt_total = $vote[vt_total]; <br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; if ($write[mb_id] == $member[mb_id]) { // 자신의 글은 그냥 출력 <br />
&nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; } else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; $is_vote = false; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_sdate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] < $vote[vt_sdate]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } else if ($vote[vt_edate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] > $vote[vt_edate]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } else&nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($is_member) $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and mb_id = '$member[mb_id]'"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and vt_ip = '$_SERVER[REMOTE_ADDR]'"); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($row) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_vote = true; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; } <br />
} <br />
<br />
$gr = array(); <br />
for ($i=1; $i<=10; $i++) $gr[] = $i; <br />
shuffle($gr); <br />
<br />
$img_path = "$g4[url]/skin/board/$board[bo_skin]/img/"; <br />
<br />
if ($mw_basic[cf_vote] && $vote && sizeof($vote_list)) { <br />
?> <br />
<br />
<br />
<br />
<div class="fs cc h50"></div> <br />
<div class="cc w100p h30 downline"> <br />
<div class="aleft bleft h30 lh34"><img src="<?=$g4[path]?>/img/vote.png" align="absmiddle" style="margin:-4px 6px 0 0;"><span class="fontw b">설문조사</span><span class="date">|</span><?=number_format($vt_total)?>명 참여</div> <br />
<div class="aright bright text11 fonts h30 lh34"><? if ($vote[vt_sdate] != "0000-00-00 00:00:00") echo substr($vote['vt_sdate'],2,2).".".substr($vote['vt_sdate'],5,2).".".substr($vote['vt_sdate'],8,2)." (".get_yoil($vote[vt_sdate]).") ".substr($vote[vt_sdate],11,2)."시 <span class='fontss text11'>-</span> "; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_edate] != "0000-00-00 00:00:00") echo substr($vote['vt_edate'],2,2).".".substr($vote['vt_edate'],5,2).".".substr($vote['vt_edate'],8,2)." (".get_yoil($vote[vt_edate]).") ".substr($vote[vt_edate],11,2)."시 까지"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_point]) echo "<span class='date'>|</span>".number_format($vote[vt_point])."P 지급<span class='date'>|</span>"; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($vote[vt_multi]) echo $vote[vt_multi]."개까지 복수선택 가능"; ?><? if ($is_admin) { ?><span class='date'>|</span><a href="#;" onclick="win_open('<?=$board_skin_path?>/proc/vote.list.php?bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>', 'vote_list', 'width=700,height=700,scrollbars=1');"><span class="fontb b text11">참여목록</span></a><? } ?></div> <br />
</div> <br />
<br />
<br />
&nbsp; &nbsp; <? if (!$is_vote && !$result_view) { //--------------------------------설문참여안함?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <div class="cc"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? for ($i=0; $i<sizeof($vote_list); $i++) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h32 lh34 downline bleft"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? if (!$vote[vt_multi]) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="radio" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } else { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="checkbox" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <label for="vt_num_<?=$i?>"><?=$vote_list[$i][vt_item]?></label> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } //for?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h40 bleft" style="margin-top:20px;"><input type="button" value="설문참여" class="btnr w100 cu" onclick="mw_vote_join()"><input type="button" value="결과보기" class="btns cu w100" onclick="mw_vote_result()"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; <? } else { //--------------------------------------설문결과?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <div class="cc"> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? for ($i=0; $i<sizeof($vote_list); $i++) { <br />
$line = $i%2; // 홀수,짝수 <br />
if ($line == "1") { $bgline = "#3e0002"; }else{ $bgline = "#4e0003";} ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h32 lh32 downline bleft" > <br />
<div style="position:absoulte;z-index:10;"> <br />
<div class="aleft bleft h30 lh34"><span class="date"></span><?=$vote_list[$i][vt_item]?></div> <br />
<div class="aright bright h30 lh34"><nobr><?=$vote_list[$i][vt_rate]?></nobr><span style="padding-right:6px;"></span></div> <br />
</div> <br />
<br />
<div class="h32" style="background-color:<?=$bgline?>;width:<?=$vote_list[$i][vt_width]?>px;"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } //for?> <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? if ($result_view) { ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="cc h40 bleft" style="margin-top:20px;"><input type="button" value="설문참여" class="btns w100 cu" onclick="mw_vote_load()"></div> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <? } ?> <br />
&nbsp; &nbsp; &nbsp; &nbsp; </div> <br />
&nbsp; &nbsp; <? } ?> <br />
<br />
<? <br />
}
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
11년 전
같은 질문을 몇번 한 것같은데 시누이님 말씀처럼 그누보드 기본 소스가 아니기 때문에
코드만 보고서는 답변하기가 어렵겠습니다
질문 내용과 사이트 그래프로 추측하자면 2명에 해당하는 것은 100%로 하고 1명은 50%
10명이 최대라면 5명은 50%, 1명은 10%...
이런 내용같은데 맞는가요?
(질문 자체를 이런식으로 해야 남이 금방 알아먹죠...이해하기 아려운 질문에 답변하려는 사람은 없을테니까요)
1. 최대치 구하기 : for문 위쪽에 추가
$maxk=sql_fetch("select vt_hit from $mw[vote_item_table] where vt_id = '$vote[vt_id]'");
2. 퍼센트 계산( $vote[vt_total] --> $maxk[vt_hit] 로 변경)
$vt_rate=$row[vt_rate]=0;
if ( !$row[vt_hit]) $row[vt_hit]=0;
$vt_rate = @round($row[vt_hit] / $maxk[vt_hit], 2) * 100;
if ($vt_rate) $row[vt_rate] = $vt_rate."% (".number_format($row[vt_hit]).") </span>";
$row[vt_width] = @intval($width * ($vt_rate / 100));
if ($vt_rate) $row[vt_rate] = $vt_rate."% (".number_format($row[vt_hit]).") </span>";
$row[vt_width] = @intval($width * ($vt_rate / 100));
정확한 내용을 모르니 맞는지 모르겠네요
하여튼 최대값 vt_hit 기준으로 상대적 퍼센트를 내는 것입니다
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
몬스터박스
11년 전
�
균이
11년 전
어떻게 돌아가는 프로그램인지 모르는 상태로 답변한 것이니
최대치 기준으로 퍼센트 내는 방법만 참고하세요
링크와 테스트 아이디만으로는 내용을 전혀 알 수 없습니다
최대치 기준으로 퍼센트 내는 방법만 참고하세요
링크와 테스트 아이디만으로는 내용을 전혀 알 수 없습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
$width = "900";
if ($mw_basic[cf_vote]) {
$vote = sql_fetch("select * from $mw[vote_table] where bo_table = '$bo_table' and wr_id = '$wr_id'");
$vote_list = array();
$sql = "select * from $mw[vote_item_table] where vt_id = '$vote[vt_id]'";
$qry = sql_query($sql);
$maxk=sql_fetch("select vt_hit from $mw[vote_item_table] where vt_id = '$vote[vt_id]'"); //개별그래프...균이2013.12.18
for ($i=0; $row=sql_fetch_array($qry); $i++) {
// $row[vt_rate] = @round($row[vt_hit] / $vote[vt_total], 2) * 100;
// if ($row[vt_rate])
// $row[vt_rate] = $row[vt_rate]."%<span class='date'>|</span>".number_format($row[vt_hit]);
// else
// $row[vt_rate] = "0";
// $row[vt_width] = @intval($width * ($row[vt_rate] / 100));
$vt_rate=$row[vt_rate]=0; //개별그래프...균이2013.12.18
if ( !$row[vt_hit]) $row[vt_hit]=0; //개별그래프...균이2013.12.18
$vt_rate = @round($row[vt_hit] / $maxk[vt_hit], 2) * 100; //개별그래프...균이2013.12.18
if ($vt_rate) $row[vt_rate] = $vt_rate."% (".number_format($row[vt_hit]).") </span>"; //개별그래프...균이2013.12.18
$row[vt_width] = @intval($width * ($vt_rate / 100)); //개별그래프...균이2013.12.18
$row[vt_item] = cut_str(get_text(strip_tags($row[vt_item])), 50);
$vote_list[$i] = $row;
}
if ($vote[vt_multi]) {
$qry = sql_query("select count(*) as cnt from $mw[vote_log_table] where vt_id = '$vote[vt_id]' group by mb_id");
$vt_total = mysql_num_rows($qry);
}
else {
$vt_total = $vote[vt_total];
}
----------------------------------------------------------------------------
위처럼 알려주신데로 수정해보앗습니다.
http://www.monsterbox.co.kr/bbs/board.php?bo_table=mb26&wr_id=4
이렇게 이탈이되어버리네요 ;;;;;;;;
테스트 아이디 : test
비번 : test
입니다.......잘못 수정한거 지적좀 부탁드립니다.......