0){ while($data = mysql_fetch_assoc($sel)){ $total = $total + $data['rating_num']; $rows++; } $perc = ($total/$rows) * 20; //$newPerc = round($perc/5)*5; //return $newPerc.'%'; $newPerc = round($perc,2); return $newPerc.'%'; } else { return '0%'; } } function outOfFive($id){ $total = 0; $rows = 0; $sel = mysql_query("SELECT rating_num FROM yp_ratings WHERE rating_id = '$id'"); if(mysql_num_rows($sel) > 0){ while($data = mysql_fetch_assoc($sel)){ $total = $total + $data['rating_num']; $rows++; } $perc = ($total/$rows); return round($perc,2); //return round(($perc*2), 0)/2; // 3.5 } else { return '0'; } } function getVotes($id){ $sel = mysql_query("SELECT rating_num FROM yp_ratings WHERE rating_id = '$id'"); $rows = mysql_num_rows($sel); if($rows == 0){ $votes = '共 0 票'; } else if($rows == 1){ $votes = '共 1 票'; } else { $votes = '共 '.$rows.' 票'; } return $votes; } function pullRating($id,$show5 = false, $showPerc = false, $showVotes = false, $static = NULL){ // Check if they have already voted... $text = ''; $sel = mysql_query("SELECT id FROM yp_ratings WHERE IP = '".$_SERVER['REMOTE_ADDR']."' AND rating_id = '$id'"); // if(mysql_num_rows($sel) > 0 || $static == 'novote' || isset($_COOKIE['has_voted_'.$id])){ if(mysql_num_rows($sel) > 0 || $static == 'novote'){ if($show5 || $showPerc || $showVotes){ $text .= '
'; } if($show5){ $text .= '評分: '.outOfFive($id).'/5'; } if($showPerc){ $text .= ' ('.getRating($id).')'; } if($showVotes){ $text .= ' ('.getVotes($id).')'; } if($show5 || $showPerc || $showVotes){ $text .= '
'; } return $text.'
'; } else { if($show5 || $showPerc || $showVotes){ $text .= '
'; } if($show5){ $show5bool = 'true'; $text .= '評分: '.outOfFive($id).'/5'; } else { $show5bool = 'false'; } if($showPerc){ $showPercbool = 'true'; $text .= ' ('.getRating($id).')'; } else { $showPercbool = 'false'; } if($showVotes){ $showVotesbool = 'true'; $text .= ' ('.getVotes($id).')'; } else { $showVotesbool = 'false'; } if($show5 || $showPerc || $showVotes){ $text .= '
'; } return $text.'
'; } } // Added in version 1.5 // Fixed sort in version 1.7 function getTopRated($limit, $table, $idfield, $namefield){ $result = ''; $sql = "SELECT COUNT(ratings.id) as rates,ratings.rating_id,".$table.".".$namefield." as thenamefield,ROUND(AVG(ratings.rating_num),2) as rating FROM yp_ratings,".$table." WHERE ".$table.".".$idfield." = ratings.rating_id GROUP BY rating_id ORDER BY rates DESC,rating DESC LIMIT ".$limit.""; $sel = mysql_query($sql); $result .= ''."\n"; return $result; } ?> 寵物移民 - 香港寵物黃頁 - PetKD 寵物網 (寵物領養、資訊廣告、用品買賣及寵奴互動平台)
PetKD 寵物網 (寵物領養、資訊廣告、用品買賣及寵奴互動平台)
PetKD 寵物網 (寵物領養、資訊廣告、用品買賣及寵奴互動平台) 寵物黃頁 寵物移民
贊助網站
共 3 間相關店鋪
Life Travel
類別: 寵物移民 評分: (共 1 票)
電話: 25283488 瀏覽: 417
地址: 尖沙咀加連威老道21A-21B德立大廈4/F
寵物也移民 Aeropet Company
類別: 寵物移民 評分: (共 3 票)
電話: 27443330 瀏覽: 456
地址: 香港仔大道234號富嘉工業大廈1610室
Jet Pet 愛犬事務所
類別: 寵物移民 評分: (共 4 票)
電話: 25718678 瀏覽: 299
地址: 香港北角堡壘街21-23號美加洋樓一字C & D室
共 3 間相關店鋪

本頁店鋪分佈地圖

廣告查詢|聯繫我們|Archiver|手機版|PetKD 寵物網

GMT+8, 2019-9-20 11:30 AM

Copyright © 2019 PetKD 寵物網 保留所有權利 - Powered by Discuz!

回頂部