Jump to content

Warning: Division by zero in ...


Netty

Recommended Posts

Not sure what to say really :)

It would seem the expression ($max-$old) is at some point zero, and thus creating the div. by zero error.  Without knowing more about the system (what do those variables represent?) I'd suggest doing a check like

[code]
if( $max != $old )
{
  $percent = round((($rankp-$old)/($max-$old))*100);
}
else
{
  ... handle the error ...
}
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.