如何使用星星显示比率值

时间:2017-08-14 03:31:04

标签: php

我试过了。但它没有成功..请给我解决方案..

php code

<?php
function getReviews($con){
        $sql = "SELECT * FROM review";
        $result = mysql_query($sql,$con);
        while ($row = mysql_fetch_array($result)) {
            echo "<div class=' col-md-12 comment-box'>";
            echo "<div class='left-comm col-md-2'>";
            echo "<img class='img-responsive' src='images/article/avatar3.png'>";
            echo "</div>";
            echo "<div class='right-comm col-md-6'>";
            echo "<p class='user-name'>".$row['email']."</p>";
            echo for ($i=0; $i <$row['rating'] ; $i++) { 
        echo "*";
    }"<br>";
            echo $row['review']."<br>";
            echo "</div>";
            echo "</div><br>";
?>

我想在此功能中使用stars.显示费率值。

1 个答案:

答案 0 :(得分:1)

变化:

  echo for ($i=0; $i <$row['rating'] ; $i++) { 
        echo "*";
    }"<br>";

为:

for ($i=0; $i <$row['rating'] ; $i++) { 
    echo "*";
}
echo "<br />";