Hey, I have a rankbar on my game, and everytime someone does a crime, the rankbar goes up so it enables them to get to the next rank e.g: }elseif ($currank == "Bounty Killer"){ $max = '2500'; $old="1500"; but the problem is, once you rank up once, the rankbar stops working and stays at 0% and says: Warning: Division by zero in rankbar.php on line 73 (i took the url out ) Anyways this is the code i have on line 73 of rankbar.php , see any problems? } $percent = round((($rankp-$old)/($max-$old))*100, 2); ?> Thanks
Well what means is that $max-$old == 0 Therefore, this is what php is trying to do. Divided by 0 is undefined, which is the reason for the error. } ($rankp-$old)/[B]0[/B] ?> Code (markup):
Thanks for that pos1tron but the error is still the same expect now it doesn't say at 0% it just says % now.
I wasn't giving a fix - I was just showing what php is trying to do to throw an error in that code bit. Sorry, but I don't know how to fix it. print() out of the script all of the variables and arrays (print_r()) for the arrays) that could have any effect upon that calculation when you rank up twice, and then manually recreate the calculations the script would do to understand what the problem is...