Solved

PHP and raking

Posted on 2004-03-25
4
160 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now