Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Percentage & Images and stuff.


ghost's Avatar
0 0

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

$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

```markup$imgtimes = $percen / 5;```

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

spyware's Avatar
Banned
0 0

Just learn your math.

Total votes / specific vote = %

barlength * (%/100)

but if %=100

Barlength * 1