Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: how to get percent out of 100%

1. ## how to get percent out of 100%

PHP Code:
``` \$abcd = round(\$rate_yes / \$rate_no * 100);  ```
rating for both fields are +1(s)

anyone know how to tell this to tell me the percent out of a 100%

Right now this shows me % like 157%..etc I want it to be out of a 100%

so for
rate_yes = 10
rate_no = 7
Thats the votes that are logged in the DB.
the real % comes out to 157%, but how do I get it to come out to a percent by 100% so it cant go over

Thanks

• a little math would be helpful … ask yourself, what exactly is represented by 100%? is it \$rate_yes, \$rate_no or something else.

• Originally Posted by Dormilich
a little math would be helpful … ask yourself, what exactly is represented by 100%? is it \$rate_yes, \$rate_no or something else.

What im trying to do is.. blank% of people like this game.. which rate_yes ?

• yea, I understand that, but your formula ain’t right.

• Originally Posted by Dormilich
yea, I understand that, but your formula ain’t right.

Okay, any help on leading me to correcting that? Out of 17 votes, 10 people liked it, just need it to read the percent of that out of a 100% ?

• so you need to translate 10 / 17 into PHP code …

• PHP Code:
``` \$rate_t = \$rate_yes + \$rate_no;  \$abcd = round(\$rate_yes / \$rate_t * 100);  ```
Believe that's the correct idea now. Sorry like 5am over here, but i'll get it

• is way better

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•