Solved

PHP and raking

Posted on 2004-03-25
4
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

636 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