Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP and raking

Posted on 2004-03-25
4
Medium Priority
?
177 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
2 Comments
 
LVL 1

Accepted Solution

by:
power_wong earned 500 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

772 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