I´ve got it to compute !
//-----------------------------------------------------
//--- Votes -------------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_votes) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
[b]$bewert = [/b]$sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_votes = "".$lang['total_votes']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_votes", $total_votes);
unset($total_votes);
and
$sql = "SELECT SUM(image_hits) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$treffer = $sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_hits = "".$lang['total_hits']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_hits", $total_hits);
unset($total_hits);
and
echo bcdiv ($bewert, $treffer, 4);
I can see the correct result on top of the screen.
But when I use this (thunderstrike) code, nothing happens!
$get_totals = bcdiv ($bewert, $treffer, 4);
if ($get_totals > 0) {
$bcdiv = $lang['bcdiv']."<B> ".$get_totals."</B>\n";
} else {
$bcdiv = $lang['bcdiv']."<B> 0 </B>\n";
}
$site_template->register_vars("get_totals", $get_totals);
I also have my "bcdiv" in the lang/main.php file
$lang['bcdiv'] = "Entspricht Prozent:";
What´s wrong in the last part of the script?
thx Mario