|
 |
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
|
|
03-12-2009, 09:48 PM
|
PM User |
#1
|
|
New Coder
Join Date: Jan 2009
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
|
Division by zero
I get this error
Warning: Division by zero in /home/sites//public_html/mini.php on line 155
Line 155 is
$percent = round((($rankp-$old)/($max-$old))*100);
|
|
|
|
03-12-2009, 09:52 PM
|
PM User |
#2
|
|
Regular Coder
Join Date: Jan 2009
Location: Norway
Posts: 118
Thanks: 8
Thanked 2 Times in 2 Posts
|
One, some or all of your variables does not have a value.
|
|
|
03-12-2009, 09:57 PM
|
PM User |
#3
|
|
New Coder
Join Date: Jan 2009
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
|
What ?
|
|
|
03-12-2009, 09:59 PM
|
PM User |
#4
|
|
UE Antagonizer

Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
|
($max - $old) * 100 = 0. You can't divide by 0; it is a mathematical impossibility.
|
|
|
03-12-2009, 10:01 PM
|
PM User |
#5
|
|
New Coder
Join Date: Jan 2009
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
|
So what do i need to put.
|
|
|
03-12-2009, 10:15 PM
|
PM User |
#6
|
|
UE Antagonizer

Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
|
You can check to see if ($max - $old) * 100 is equal to zero prior to dividing by it.
|
|
|
03-13-2009, 04:01 AM
|
PM User |
#7
|
|
Supreme Master coder!

Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
|
Actually just check to see if $max-$old equal 0 before you divide by it since the * 100 is outside of the parentheses.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
|
|
|
 |
Jump To Top of Thread
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 10:58 AM.
|
Advertisement Log in to turn off these ads. |
|
|
|
|
|
|
|
|
|
|