Hey everyone. I ported over the calculation that was used often in vB2 to calculate Active/NonActive members and the Activity %, and I remember having problems with it before with the percentage displaying a massive negative number after months of working properly before. I just simply removed the hack and forgot about the glitch, but now that I'm using it again I've decided to ask here on advice to how to fix it.
Basically when the member count goes above 1000 the calculation screws up:
Quote:
Total Registered Members: 1,000 (Active: -377, Inactive: 378) | Activity Rate: -37700.00 %
|
When before that it was working correctly.
Here is my PHP Code for the calculation of the stat:
PHP Code:
// calculate active and non active members from member stats
$snonposters=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user WHERE posts=0');
$nonposters=$snonposters['users'];
$activemembers=$numbermembers-$nonposters;
$activityrate=sprintf("%.2f",(100*$activemembers/$numbermembers));
Any help would be greatly appreciated! Thanks!