PHP Dynamic Rating Bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziycon
    Contributor
    • Sep 2008
    • 384

    PHP Dynamic Rating Bar

    I'm trying to create a dynamic rating bar which is out of 10, data is retrieved from the DB and is from 1 to 10, i was trying to use the imagefilledrect angle() function with no luck, any suggestions on an easier way to create one?
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi ziycon.

    I don't really get what the problem is.
    Are you having difficulties displaying the data, or what?

    If you simply need to show a "progress bar" of sorts to represent the rating, you could try just using CSS.

    Like, say:
    [code=html]
    <div style="width: 100px; height: 20px; background: #000;">
    <div style="width: <?php echo ($rating * 10); ?>%; height: 20px; background: #AAA;"></div>
    </div>
    [/code]
    Where $rating is a value between 0 and 10.

    If that isn't what you are looking for, please try explaining the problem a little better.

    Comment

    • ziycon
      Contributor
      • Sep 2008
      • 384

      #3
      Got it sorted, i used CSS to display a bar based on a calculation out of 100%.

      Comment

      Working...