I'm using a library called Jquery Bar Rating for the use of rate with 5 stars, I have comments saved in a table with a rate of 1 to 5 stars each, and those comments I printed them with a while:
while($row = mysqli_fetch_assoc($res)):
echo '<blockquote>
<select class="seeRate">//Select para mostrar estrellas
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<p class="text-justify" style="font-size: 14px;">'.ucfirst($row['note']).'</p>
<small class="pull-right"><cite><i>'.ucwords(getNameEmp($row['noteBy'])).' - '.$row['noteAt'].'</i></cite></small>';
echo '</blockquote>';
echo '<script>$(\'.seeRate\').barrating(\'show\');</script>';
endwhile;
And this is the trigger for the stars:
$('.seeRate').barrating({
theme: 'bootstrap-stars',
readonly: false
});
});
at the moment of putting the stars inside the while, they only show up well in the first comment, in the others only the dropdown without style is shown, as if the library could not be found.