Solved

PHP and raking

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
EvenOdd challenge 10 83
Visual xHarbour 1 77
commonTwo  challenge 63 101
count8 challlenge 13 87
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

746 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

13 Experts available now in Live!

Get 1:1 Help Now