How can i disable it in a particulair script without changing phpinin and stuff like that, just in the script itself turn it off
it's a dumb error anyway, why would i need a warning for it, there nothing wrong with a number being dvided by zerohttp://ca.php.net/manual/en/function.error-reporting.phpOriginally posted by yoda
How can i disable it in a particulair script without changing phpinin and stuff like that, just in the script itself turn it off
it's a dumb error anyway, why would i need a warning for it, there nothing wrong with a number being dvided by zero
Well technically there is, especially in mathematics. It's not 0, it has a limit which it will reach as it heads towards zero, but it's not 0... If I recall Calc 1 correctly... I hated Calc 1 though...
Well if you show the script code I could come up with a quick fix. You could do this...
if ($partthatcomesupaszero == 0)
{
$partthatcomesupaszero=1;
}
That is if you're taking the average of stuff aka you have 0/0 when you do it anyhow.
If you're actually doing a real number not including 0 over 0 then that won't work, it will give you the number... But 0/1 = 0 so it will display as 0 still without having to mess with the code too much.
-Tim
Show your code if you need more help please. basicly it's like this
$temp1 = ($farms/$totbuildings)*100;
both vars depend on the user, the only time it's o/o is when a user has just newly registered. than $farms and $totbuildings are both 0.
doing
if(!$farm) $farm = 1;
if(!$totbuildings) $totbuildings = 1;
}
would give wrong results.Originally posted by yoda
basicly it's like this
$temp1 = ($farms/$totbuildings)*100;
both vars depend on the user, the only time it's o/o is when a user has just newly registered. than $farms and $totbuildings are both 0.
doing
if(!$farm OR !$totbuildings){
$farm = 1;
$totbuildings = 1;
}
would give wrong results.
if($totbuildings==0){
$totbuildings = 1;
}
$temp1 = ($farms/$totbuildings)*100;
Will give the right results. (Assuming totbuildings is the total of all the buildings including the farms)there is something wrong. you cannot divide by zero. in no math you can divide by zero.
if they are both zero then just don't do that calculations.
if($farms >0 AND $totbuildings >0){
$temp1 = ($farms/$totbuildings)*100;
} else {
$temp1 = "0%";
}
it's a dumb error anyway, why would i need a warning for it, there nothing wrong with a number being dvided by zerohttp://ca.php.net/manual/en/function.error-reporting.phpOriginally posted by yoda
How can i disable it in a particulair script without changing phpinin and stuff like that, just in the script itself turn it off
it's a dumb error anyway, why would i need a warning for it, there nothing wrong with a number being dvided by zero
Well technically there is, especially in mathematics. It's not 0, it has a limit which it will reach as it heads towards zero, but it's not 0... If I recall Calc 1 correctly... I hated Calc 1 though...
Well if you show the script code I could come up with a quick fix. You could do this...
if ($partthatcomesupaszero == 0)
{
$partthatcomesupaszero=1;
}
That is if you're taking the average of stuff aka you have 0/0 when you do it anyhow.
If you're actually doing a real number not including 0 over 0 then that won't work, it will give you the number... But 0/1 = 0 so it will display as 0 still without having to mess with the code too much.
-Tim
Show your code if you need more help please. basicly it's like this
$temp1 = ($farms/$totbuildings)*100;
both vars depend on the user, the only time it's o/o is when a user has just newly registered. than $farms and $totbuildings are both 0.
doing
if(!$farm) $farm = 1;
if(!$totbuildings) $totbuildings = 1;
}
would give wrong results.Originally posted by yoda
basicly it's like this
$temp1 = ($farms/$totbuildings)*100;
both vars depend on the user, the only time it's o/o is when a user has just newly registered. than $farms and $totbuildings are both 0.
doing
if(!$farm OR !$totbuildings){
$farm = 1;
$totbuildings = 1;
}
would give wrong results.
if($totbuildings==0){
$totbuildings = 1;
}
$temp1 = ($farms/$totbuildings)*100;
Will give the right results. (Assuming totbuildings is the total of all the buildings including the farms)there is something wrong. you cannot divide by zero. in no math you can divide by zero.
if they are both zero then just don't do that calculations.
if($farms >0 AND $totbuildings >0){
$temp1 = ($farms/$totbuildings)*100;
} else {
$temp1 = "0%";
}