Hi, I want to display the avearage row as images. Is it possible?

function reviews_average(){

            $avgproduct_id = escape_string($_GET['id']);

            $avgquery = "SELECT avg(rating) as average_rating FROM reviews WHERE product_id = $avgproduct_id";
            $avgresults = query($avgquery);
            confirm_query($avgquery);

            while($row = fetch_array($avgresults)){

            $avgratings = **--THIS IS THE ONE I WANT TO DISPLAY AS IMAGES--** "{$row['average_rating']}";    

            echo $avgratings; 
   }
 }

This is the image

<img src='../public/images/star.png' height='20px' width='20px'/>

I’m on my phone in bed so it’s hard to type our code but you can use php’s string repeater function.

https://www.php.net/manual/en/function.str-repeat.php

You can echo out the image html tag the number of times based on the rating.

You could do this with a simple for loop as well but this function is easier.