Page 1 of 1

Warning: Division by zero error

Posted: Sat Feb 23, 2008 11:50 pm
by sweet160
Hi,

After I uploade my site I got this division by zero error.

Here is the code

if ($color_index && isset($tab_colors[($tab_index)%count($tab_colors)])) {
$id .= $tab_colors[($tab_index)%count($tab_colors)];
$tab_index++;

}


ANybody know how do I can fix this?

Thanks!

Re: Warning: Division by zero error

Posted: Sun Feb 24, 2008 4:30 am
by Rogue4ngel
Sounds more like an installation issue than it does a coding problem (you haven't done any custom coding to the site, have you?). What version of Joomla are you using?

Re: Warning: Division by zero error

Posted: Sun Feb 24, 2008 5:43 am
by ianmac
sweet160 wrote:Hi,
if ($color_index && isset($tab_colors[($tab_index)%count($tab_colors)])) {
$id .= $tab_colors[($tab_index)%count($tab_colors)];
$tab_index++;
}
Division by zero errors indicate you are dividing by zero - the value of this is undefined.

The only thing you are dividing by in here is count($tab_colors).

Change if to:
if ($color_index && count($tab_colors) != 0 && isset($tab_colors[($tab_index)%count($tab_colors)])) {


Ian

Re: Warning: Division by zero error

Posted: Sun Feb 24, 2008 7:29 am
by sweet160
Ian,

Your the man! Its ok now, the errors are gone, and my website looks great thanks to you!

I cannot thank you enough

CHeers dude

Re: Warning: Division by zero error

Posted: Fri Mar 07, 2008 4:37 pm
by ryanmcgr
Hey guys,
I'm also getting a division by zero error - Warning: Division by zero in /home/paradise/public_html/home/templates/rt_modbusiness/rt_splitmenu.php on line 63

This is the chunk of code.. any ideas? Thanks a bunch

Code: Select all

				}
			}
			break;
			case 'content_typed':
			default:
			$mitem->link .= '&Itemid='. $mitem->id;
			break;
		}
default: is the line 63

Re: Warning: Division by zero error

Posted: Mon Mar 10, 2008 1:31 pm
by Rogue4ngel
I don't see a division problem there. Could be the item is null (doesn't exist)? I'm not sure.