![]() |
percentage code is way off on large boards
Can anyone plaese tell me what I am doing wrong in the following code that would cause larger boards with high post and thread counts to display these percentages really far off?
PHP Code:
15,300 Posts (15,300.00%) I have tried different variations of this and they all turn out the same. |
Don't know if this'll work or not, but try dividing by a hundred (or 10 or 1000):
PHP Code:
|
Thanks. Steve. I'll have someone with a large board test this and get back to you here with the results. ;)
|
Steve, do you know how to take the last 2 zeros after the decimal point off on a whole percent? Like if it is 50.00%, how would you make it so it showed up as 50%, but ONLY on whole percentages? If it is like 50.05%, I want that to show up.
|
you could round it;)
|
But that wouldn't leave it if it was 50.05%, would it? ;)
|
you could creat some kind if statement:)
|
Any examples? ;)
|
Quote:
PHP Code:
|
As long as it works, that's all that really counts. Thank you, sir. ;)
Would you have any ideas on the percentage problems for bigger boards? ) EDIT: How would I incorporate this with this code? PHP Code:
|
What does the $newuserid variable represent?
|
Either way - to figure out percentages, you divide the small number by the big number, and multiple by 100.
Looking at your code, I think you're doing it the other way round. (Presuming that $numbermembers is the total number, and $newuserid is the fraction of that.) If $newuserid is the bigger number, ignore the variable switch I made in the vb_number_format function below. I've also removed the if statement, as I can't see what the difference is between the code in each branch. PHP Code:
|
Also, instead of $newuserid, shouldn't it be $activemembers?
|
Quote:
I used this same code at one time and it seems that any boards that have over 1000 posts mess up with the percentage like this. It ends up showing like 15,300%. What would cause this to be happening? On my small site I don't have that problem. It works great for me. |
What do you get with $numbermembers / $newuserid?
|
I get this:
Quote:
|
All times are GMT. The time now is 03:03 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|