이 소스로 한번 바꿔보아는데.. 정보
이 소스로 한번 바꿔보아는데..
본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("./_common.php");
$sql = " select bo_count_write from $g4[board_table] where bo_table = '05_3' ";
$bbs1 = sql_fetch($sql);
$sql = " select bo_count_write from $g4[board_table] where bo_table = '06_1' ";
$bbs2 = sql_fetch($sql);
//exp_bar
function exp_bar($level) {
global $g4;
$point = $level;
$level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함.
if($level < 1) $level = 1;
if ($level > 154) $level = 154;
$no = sprintf("%03d", $level);
$max = $level * $bbs2['bo_count_write'];
$bar = (int)($point / $max * 100);
$graph = $bar."%";
echo "<table width='133' border='0' cellspacing='0' cellpadding='0' align='center'><tr height=30><td width='33'><img src='$g4[path]/img/class.gif'></td><td width='20' align='right'><img src='$g4[path]/img/l/{$no}.gif'></td><td align='right'><font color='#B3D4F8'>$point</font>/$max</td></tr><tr><td colspan='2'><img src='$g4[path]/img/exp.gif'></td><td align='right'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar.gif'><table width='133' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='1'></td></tr><tr height='8'><td width='1'></td><td width='130'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr colspan='3'></table></td></tr></table>";
}
?>
뭐가 문제인지 지적과 수정 좀 부탁 드려도 되련지..ㅠㅠ
아니.. 한수 가르쳐주세여..ㅠㅠ
초보자의 설움..ㅠㅠㅠㅠㅠ
0
댓글 23개

그 두개의 게시물 수로 평균값을 뽑으려고 합니다
그러니깐.. 예를들어서 게시판은1은 행복한것만 올리구요
게시판2는 나쁜것만 올리구요
나쁜게 더 많으면 평균값 퍼센트는 낮아지고
좋은것 많으면 평균값 퍼센트는 높아지고..
100%를 기준으로 해서요..ㅠㅠ
일단 $bbs1 , $bbs2 배열이 함수내에서 선언이 안돼어 있네욜,,
global $g4,$bbs1,$bbs2;

이거 밑에 넣으면 되죠

혹시 아시면 소스 좀 어떻게 안될까요???

그냥 흰공백.. 결과값이 안나오네여.ㅠㅠㅠ
그냥. 01happy.php 만들어서 그누디렉토리에 업로드해서 실행했어요
이랬더니.. 결과 무 흰공백만..ㅠㅠㅠ
여기서 막히고 있군요 --;;;
삭제 요망

exp_bar 함수 호출 부분이 없어여...

안될까요..ㅠㅠ
// if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 주석 처리
include_once("./_common.php");
$sql = " select bo_count_write from $g4[board_table] where bo_table = '05_3' ";
$bbs1 = sql_fetch($sql);
$sql = " select bo_count_write from $g4[board_table] where bo_table = '06_1' ";
$bbs2 = sql_fetch($sql);
$level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함. 새로 추가
exp_bar($level); // 새로 추가
//exp_bar
function exp_bar($level) {
global $g4,$bbs2; // $bbs2 추가
$point = $level;
// $level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함. 주석 처리
if($level < 1) $level = 1;
if ($level > 154) $level = 154;
$no = sprintf("%03d", $level);
$max = $level * $bbs2['bo_count_write'];
$bar = (int)($point / $max * 100);
$graph = $bar."%";
echo "<table width='133' border='0' cellspacing='0' cellpadding='0' align='center'><tr height=30><td width='33'><img src='$g4[path]/img/class.gif'></td><td width='20' align='right'><img src='$g4[path]/img/l/{$no}.gif'></td><td align='right'><font color='#B3D4F8'>$point</font>/$max</td></tr><tr><td colspan='2'><img src='$g4[path]/img/exp.gif'></td><td align='right'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar.gif'><table width='133' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='1'></td></tr><tr height='8'><td width='1'></td><td width='130'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr colspan='3'></table></td></tr></table>";
}
?>
이 소스로 갈아타보세욜

덕분에 출력 되네요..ㅠㅠ
담엔 오류 상황을 자세히 적어 보시는게 ㅎㅎ,,,
직접 소스돌리기가 귀찮아서리,,,
홈페이지 잘 나오시길,,

죄송해요..
덕분에 잘 나와요..ㅠㅠ
진념님 한가지더 질문 좀 할게요
그게 뭐냐면요
100%기준으로 $bbs1 이건 좋은것.. $bbs2 이건 나쁜걸루 해서요
나쁜건 퍼센트가 줄여지게 하려면 어떻게 하나요..ㅠㅠ

퍼센트로 그래픽으로 출력이 되잖아요
거기서 두번째게시판은 불만게시판이라서..
퍼센트에서 제외하고 싶다는 말이였어요..ㅠㅠ
그리고 퍼센트가 딱 100퍼센트까지만 기록하려면 어떻게 하나요

진념은 그래도 너무 감사합니다

다행히도 퍼센트공식은 스스로 해결했어요..ㅠㅠ
수고하셔용! ㅋ

저 아이디 hyunho1004 이거 하나랍니다..