채택완료

댓글평점을 산출 하려고 하는데요. 한번 검사좀 해주십쇼~

2017-09-23 (토) 20:05:16 2,837
Copy
<style>.starRating,.starRating span{ display:inline-block; height:14px; height:14px; background:transparent url(<?=$board_skin_url?>/img/icoFiveStar.gif) no-repeat; overflow:hidden;} /* 수정 필요 */.starRating{ width:79px; vertical-align:middle;}.starRating span{ font-size:0; line-height:0; vertical-align:top; text-indent:-100px; *text-indent:0; background-position:0 -14px;}</style>
Copy
<?$cmtpoint ='0';$totalcount = '0';$userrating = '0';$tbl = "{$g5[write_prefix]}{$bo_table}";$sql2 = " select wr_4 from $tbl where wr_is_comment > 0 && wr_parent = '$wr_id' && wr_4 > '0' ";$result2 = sql_query($sql2);while($row2 = mysqli_fetch_array($result2)  ) {$point=$row2[0];$cmtpoint=$cmtpoint + $point;$totalcount++;}if ($totalcount!=0) {$cmtpoint= $cmtpoint/$totalcount;$cmtpoint= number_format($cmtpoint,2);}?><span class="starRating"><span style="width:<?php echo $list[$i][$cmtpoint]?>0%"></span></span>

wr_4 여분필드에 댓글점수(1점-10점)까지 부여하여 평균점수를 산출 하여

별점으로 출력하려고 하는데요, 이미지는 출력이 되는데 별갯수가 작동을 않합니다 ㅠㅠ

어디에 무엇을 수정해야 되는지 좀 부탁드릴께요~

충성~!

|

답변 2개

채택된 답변
+20 포인트
2017-09-23 (토) 20:16:28

다음과 같이 수정하면 될 듯 합니다.

Copy
if ($totalcount!=0) {$cmtpoint= $cmtpoint/$totalcount;$cmtpoint= number_format($cmtpoint,2);}$list[$i][cmtpoint] = $cmtpoint; ?><span class="starRating"><span style="width:<?php echo $list[$i][cmtpoint]?>0%"></span></span>
2017-09-23 (토) 21:10:28

감사합니다.^^ 대단히 감사합니다.

즐거운 주말 보내십시요^^

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