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

PHP Code:
``` //Calculate EXP %    global \$experc;    global \$expopp;    \$expn   = \$userstats3[level] * 65;    \$experc = \$userstats3[exp] / 100 * \$expn;    \$experc = round(\$experc,0);    \$exopp  = 100 - \$experc;    E X P : <?php echo \$experc ?>%        <img src="greenbar.png" width="<?php echo \$experc ?>" height="10"><img src="redbar.png" width="<?php echo \$exopp ?>" height="10"> ```

for some reason it wont stop at 100% and i cant seem to fix this problem.
i could really use the help as i am not the best coder thank you, Nate

• You're code isn't very clear but to find percentage you divide by the total then multiply by 100 not divide by 100 then multiply by the total

PHP Code:
``` \$experc = \$userstats3[exp] / \$expn * 100;  ```
Edit:

On second thoughts, that will just give a high percentage all the time, what you need to do is this (in pseudo-code):

Code:
`(UsersXP - totalXPforPreviousLevel)/(totalXPforNextLevel - totalXPforPreviousLevel) * 100`

• ## Users who have thanked Mwnciau for this post:

rebel-rpg (08-30-2009)

• Originally Posted by Mwnciau
You're code isn't very clear but to find percentage you divide by the total then multiply by 100 not divide by 100 then multiply by the total

PHP Code:
``` \$experc = \$userstats3[exp] / \$expn * 100;  ```
Edit:

On second thoughts, that will just give a high percentage all the time, what you need to do is this (in pseudo-code):

Code:
`(UsersXP - totalXPforPreviousLevel)/(totalXPforNextLevel - totalXPforPreviousLevel) * 100`

accually i used:

PHP Code:
```  \$experc = \$userstats3[exp] / \$expn * 100;  ```
and that seemed to fix it. it only goes over by a lil bit. but once you battle again then it just goes back down.

example:
it will be at 95%, after you click battle again, it goes to 110%, then after you click battle one more time it will go back to 7%. so its working alright i guess, that and i dont know what this means..:
Code:
`(UsersXP - totalXPforPreviousLevel)/(totalXPforNextLevel - totalXPforPreviousLevel) * 100`
could i paste it were this is?

PHP Code:
```  \$experc = \$userstats3[exp] / \$expn * 100;  ```

•

#### Posting Permissions

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