Gossamer Forum
Home : Products : Links 2.0 : Discussions :

An error message when I build

Quote Reply
An error message when I build
I've been happily running my links directory for the last 6-8 months with no problems.

Today I tried to 'build all' and I got this message.....

CGI ERROR
==========================================
Error Message : fatal error: Illegal division by zero at /home/sites/site352/users/whichbingo/web/cgi-bin/cgi-bin/admin/nph-build.cgi line 432, chunk 626.

Script Location : /home/sites/site352/users/whichbingo/web/cgi-bin/cgi-bin/admin/nph-build.cgi

Can anyone shed any light on this? I haven't changed any settings on anything.

Cakey

Quote Reply
Re: An error message when I build In reply to
Hi,

From lines 431 - 437 replace:

Code:
if (exists $votes{$id}) {
$values[$db_rating] = (($values[$db_rating] * $values[$db_votes]) + $rating{$id}) / ($values[$db_votes] + $votes{$id});
$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
...with...

Code:
if (exists $votes{$id}) {
$values[$db_rating] = eval { (($values[$db_rating] * $values[$db_votes]) + $rating{$id}) / ($values[$db_votes] + $votes{$id}); };
if ($@) {
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
This is a dirty solution but should work.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/