Changeset 70 for trunk


Ignore:
Timestamp:
Apr 1, 2010, 1:38:28 PM (14 years ago)
Author:
roby
Message:

funzione per gestione calcolo percentuali: applicata a funzione gruppo_rss

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/modules/Elezioni/funzioni.php

    r66 r70  
    311311                                $gruppinum=mysql_num_rows($res);
    312312                                $altrivoti=0;
     313###### gestione percentuali
     314                                $arperc=array();
     315                                $arval=array();
     316                                $arvaltot=0;
     317                                while (list($id,$num,$descrizione,$voti)  = mysql_fetch_row($res)){
     318                                $arval[$id]=$voti;
     319                                $arvaltot+=$voti;
     320                                }
     321                                $arperc=arrayperc($arval,$arvaltot);
     322                                mysql_data_seek($res,0);
     323######
    313324                                while (list($id,$num,$descrizione,$voti)  = mysql_fetch_row($res)){
    314325
     
    323334                                if ($tot!='' and $tot!='0')
    324335                                $pro[$i]=number_format($voti*100/$tot,3);
    325                                 $pro[$i]=number_format($pro[$i],2); // arrotondamento
     336                                $pro[$i]=number_format($arperc[$id],2); // arrotondamento
    326337                               
    327338
Note: See TracChangeset for help on using the changeset viewer.