Tehcheese Posted April 12, 2007 Share Posted April 12, 2007 keep gettin this error on my site and it looks a terrible mess and i cant find anyone to help me public_html/3x/components/com_serverstat/serverstat.php on line 556 556: if ($row->tcounter > $serverstat_threshold && ($row->views % $serverstat_threshold !=0) && $serverstat_threshold !=0) { PLEASE HELP Link to comment https://forums.phpfreaks.com/topic/46732-warning-division-by-zero-in/ Share on other sites More sharing options...
kenrbnsn Posted April 12, 2007 Share Posted April 12, 2007 The "%" operator implicitly performs a divide operation, so it must be that the variable $serverstat_threshold is 0 at some point. Since the conditions in the if statement are evaluated left to right, the division operation is done before the check if the variable is not zero. You have to switch the order of the conditions: <?php if ($serverstat_threshold !=0 && $row->tcounter > $serverstat_threshold && ($row->views % $serverstat_threshold !=0)) { ?> Ken Link to comment https://forums.phpfreaks.com/topic/46732-warning-division-by-zero-in/#findComment-227705 Share on other sites More sharing options...
Tehcheese Posted April 12, 2007 Author Share Posted April 12, 2007 works like a dream. thanks for the quick and good work Link to comment https://forums.phpfreaks.com/topic/46732-warning-division-by-zero-in/#findComment-227713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.