Follow us on Twitter!
It is never to LATE to become what you never WERE.
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 14
Guests Online: 13
Members Online: 1

Registered Members: 82889
Newest Member: Geriztul
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

PHP Percentage & Images and stuff.


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 31-07-07 17:55
Rite .. Well as i said yesterday .. I have to make a poll script pretty fast.
And i've got one problem, displaying the results graphicly with a bar chart.

So, i managed to work out how to get the percentage of votes an item has.

btw. row two is just how may people have voted all together
and ans1 is just an option they could have picked and how many people voted for it

Code
$overall = $row[2];
$votes4 = $ans1;
$decper = $votes4 / $overall;
$percen = $decper * 100;




So, with the image ... 100% is 200px width and 10px height, but i made the image to 5% = 20px width ... so

Code
$imgtimes = $percen / 5;




So now i need a loop that displays the image $imgtimes amount of times ... Any more information needed .. msg me




Edited by on 31-07-07 17:55
Author

RE: PHP Percentage & Images and stuff.

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 31-07-07 19:00
Just learn your math.

Total votes / specific vote = %

barlength * (%/100)

but if %=100

Barlength * 1



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce