Solved

PHP and raking

Posted on 2004-03-25
4
163 Views
Last Modified: 2010-04-17
Hi,

I am trying to write a program with PHP4, which useres be able to leave their ranking from 0 - 5 and I be able to show it as graph, for example I put 5 empty star and any time some one rank that item, it update the ranking in database and the fill out those star from one two five and be able to update it self any time some one leave new rank for the item.


or instead or star just regular statuse bar.


Any one knows how?

Golnoosh
0
Comment
Question by:Golnoosh
4 Comments
 
LVL 1

Accepted Solution

by:
power_wong earned 125 total points
ID: 10679114
It should be easy. I assume you know how to write codes to let your reader to save their points of review to your database:
<?php
  $total_of_points = 35;
  $no_of_reviewers = 10;
  // $total_of_points and $no_of_reviewers should be received from your database
  $no_of_star = $total_of_points/$no_of_reviewers;
  $max_no_of_star = 5;
  $empty_star_image = "<img src=\"images/empty_star.gif\">";
  $star_image = "<img src=\"images/star.gif\">";
  for ($i = 0; $i < $no_of_star;$i++)
    echo $star_image;
  if ($no_of_star < $max_no_of_star)
  {
        for ($i = 1;$i <= $max_no_of_star - $no_of_star;$i++)
         echo $empty_star_image;
  }
?>
0
 
LVL 1

Expert Comment

by:j_chakraverty
ID: 10679499
you have got the programme loginc from powerwong just an addition about status bar
you shall need only2 images and simply put the widths according to the data.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question