I am pretty new to star rating system, I have made a rating from 1 to 5 and it successfully store in my back end system, the rating store at back end was in a range of number 1 to 5. However, I would like to echo these numbers using image star, I put in the if statement and it does not show in my website.
<?
if ('rating' == '1'){
echo '<img scr = "https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png"/>';
}
if ('rating' == '2'){
echo '<img scr = "https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png"/>';
}
if ('rating' == '3'){
echo '<img scr = "https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png"/>';
}
if ('rating' == '4'){
echo '<img scr = "https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png"/>';
}
if ('rating' == '5'){
echo '<img scr = "https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png
https://cdn1.iconfinder.com/data/icons/ledicons/star_2.png"/>';
}
?>
here is my code for the if statement, for you information, this is within the loop which I had added also $i=1 in the front and $i++ at the back, may I know did I put anything wrong?
For anyone coming here for a solution, this should work.