"; $riga5=" | |||
"._VOTANTI." | "; foreach($_SESSION['confr'] as $y=>$x){ $res= mysql_query("SELECT sum(maschi+femmine) from ".$prefix."_ele_sezioni where id_cons='$x'",$dbi); list($elet)=mysql_fetch_row($res); $res= mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$x'",$dbi); list($tot[$y])=mysql_fetch_row($res); $res = mysql_query("SELECT t1.descrizione FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune='$id_comune' and t2.id_cons='$x'", $dbi); list($descr)=mysql_fetch_row($res); $riga1.="$descr | "; $riga5.="".$tot[$y]." ".number_format($tot[$y]*100/$elet)."% | ";
// dati per grafico
$descriz[$y]=$descr;
$perctot[$y]=number_format($tot[$y]*100/$elet);
}
$riga1.="|
$grp1 | "; if($grp2)$riga3="|||
$grp2 | "; if($grp3)$riga4="|||
"._ALTROGRP." | "; else $riga4=''; #for ($x=1;$x<=$pags;$x++){ foreach($_SESSION['confr'] as $x=>$y){ $perc1=number_format(($ar1[$x]*100/$tot[$x]),2); $perc2=number_format(($ar2[$x]*100/$tot[$x]),2); $perc3=number_format(($ar3[$x]*100/$tot[$x]),2); $perc4=number_format(($ar1[$x]*100/$tot[$x]),3); $perc5=number_format(($ar2[$x]*100/$tot[$x]),3); $perc6=number_format(($ar3[$x]*100/$tot[$x]),3); if (($perc1+$perc2+$perc3)>(100.00)){ if((($perc4*1000)%10)<(($perc5*1000) % 10)) $max=1; else $max=2; if ($max==1) if((($perc4*1000)%10)>(($perc6*1000)%10)) $max=3; elseif((($perc5*1000)%10)>(($perc6*1000)%10)) $max=3; if($max==1)$perc1-=0.01; elseif($max==2)$perc2-=0.01; else $perc3-=0.01; }elseif (($perc4+$perc5+$perc6)<(100.00)) { if((($perc4*1000)%10)>(($perc5*1000) % 10)) $max=1; else $max=2; if ($max==1) if((($perc4*1000)%10)<(($perc6*1000)%10)) $max=3; elseif((($perc5*1000)%10)<(($perc6*1000)%10)) $max=3; if($max==1)$perc1+=0.01; elseif($max==2)$perc2+=0.01; else $perc3+=0.01; } if($grp1)$riga2.= "".$ar1[$x]." $perc1% | ";
if($grp2)$riga3.= "".$ar2[$x]." $perc2% | ";
if($grp3)$riga4.= "".$ar3[$x]." $perc3% | ";
// per grafici
$percg1[$x]=$perc1;
$percg2[$x]=$perc2;
$percg3[$x]=$perc3;
}
if($grp1)$riga2.="