Jump to content

Warning: Division by zero in


Tehcheese

Recommended Posts

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

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

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.