How to do star ratings in php


I tried some online code and it is not working

any suggestion please



I’d generally consider star ratings to be a mostly html/js thing. The PHP side kinda only have to store whatever rating value was selected, and perhaps use that value when iterating out the stars and marking them up accordingly.


What are you attempting to “star”? I set up one once a long time ago for rating a video playing site.
They had a thumbs up and down for each video. When pressed the value for that username was saved.
So, to show the overall value in stars, A simple query got the percentage of thumbs-up and thumbs-down.
And, that was used to show 0 to 5 stars. Really depends on what you are attempting to show your users.