I am working on CStar rating widget in yii. I have done as follows:
$review = Reviews::model()->findAll();
foreach($review as $review)
{
$rate=$review['rating'];
$this->widget('CStarRating',array(
'name'=>'rating',
'minRating'=>1,
'maxRating'=>5,
'starCount'=>5,
'value'=>$rate,
'readOnly'=>true,
));
echo "<br/>";
echo $review['title'];
echo "<br/>";
echo "<font color='brown'>".ucfirst($review['name'])."</font><br/>";
echo $review['body'];
echo "<hr/><br/>";
}
?>
When I enter one review in the database, then it is ok but as I add a 2nd review, then both the review stars get mixed.
What should I do in this case?