Ignore:
Timestamp:
Apr 13, 2019, 8:05:15 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/modules/Elezioni/blocchi/00_affluenze.php

    r2 r265  
    1313// numero sezioni scrutinate
    1414//              $res2 = mysql_query("select *  from ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
    15                 $res2 = mysql_query("select t1.*  from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' $circos",$dbi);
    16                 $sezioni=mysql_num_rows($res2);
     15                $sql="select t1.*  from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' $circos";
     16                $res2 = $dbi->prepare("$sql");
     17                $res2->execute();
     18
     19                $sezioni=$res2->rowCount();
    1720               
    1821//echo "select *  from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos";       
     
    3134#x Luciano: quella sopra diventa quella sotto. in rilaff ci sono tutte le date e orari di affluenza mentre in vot_parziale solo quelli inseriri
    3235# inoltre va messo il desc anche alla data altrimenti il risultato ha la data piu' bassa e l'ora piu' alta
    33     $res = mysql_query("select orario,data  from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order  by data desc,orario desc limit 1", $dbi);
     36    $sql="select orario,data  from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order  by data desc,orario desc limit 1";
     37        $res = $dbi->prepare("$sql");
     38        $res->execute();
     39
    3440    if($res){
    3541
    36         while(list($orario,$data) = mysql_fetch_row($res)) {
     42        while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) {
    3743                list ($ore,$minuti,$secondi)=explode(':',$orario);
    3844                list ($anno,$mese,$giorno)=explode('-',$data);
    3945                $tot_v_m=0;$tot_v_d=0;$tot_t=0;
    4046       
    41                 $res1 = mysql_query("select t3.*  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos  group by t3.id_sez ",$dbi);
     47                $sql="select t3.*  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos  group by t3.id_sez ";
     48                $resl = $dbi->prepare("$sql");
     49                $resl->execute();
    4250
    43                 $numero=mysql_num_rows($res1);
     51
     52                $numero=$res1->rowCount();
    4453       
    4554                echo "<br /><div><h5>Ultime Affluenze</h5></div>";
     
    5160               
    5261#modifica del 26giugno 09 per gestione circoscrizionali
    53 if($genere==0)          $res1 = mysql_query("select sum(t1.voti_complessivi), t2.num_gruppo , t2.id_gruppo from ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2 on (t1.id_gruppo=t2.id_gruppo) where t1.id_cons='$id_cons' and t1.orario='$orario' and t1.data='$data' group by t2.num_gruppo,t2.id_gruppo order by t2.num_gruppo " , $dbi);
     62if($genere==0)         
     63        $sql="select sum(t1.voti_complessivi), t2.num_gruppo , t2.id_gruppo from ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2 on (t1.id_gruppo=t2.id_gruppo) where t1.id_cons='$id_cons' and t1.orario='$orario' and t1.data='$data' group by t2.num_gruppo,t2.id_gruppo order by t2.num_gruppo " ;
     64
     65
    5466else
    55                 $res1 = mysql_query("select sum(t3.voti_complessivi),0,0  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos",$dbi);
     67        $sql="select sum(t3.voti_complessivi),0,0  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos";
     68$resl = $dbi->prepare("$sql");
     69$resl->execute();
     70
    5671#fine modifica
    5772                                                                                                                                       
     
    5974               
    6075                                                                                                                             
    61                 while(list($voti_t, $num_gruppo,$id_gruppo) = mysql_fetch_row($res1)) {
     76                while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) {
    6277//              $res1 = mysql_query(,$dbi);
    6378//                      $query="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where orario='$orario' and data='$data' and id_cons='$id_cons'";
    64 $query="select sum(t3.voti_complessivi)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos";               
    65                         if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";}
    66                         $res_aff=mysql_query($query, $dbi);
    67                         $voti_numero=mysql_num_rows($res_aff);
     79$sql="select sum(t3.voti_complessivi)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos";         
     80    if ($genere==0){$sql.=" and t3.id_gruppo=$id_gruppo";}
     81                $res_aff = $dbi->prepare("$sql");
     82                $res_aff->execute();
     83
     84                        $voti_numero=$res_aff->rowCount();
    6885 //                     $query="select sum(maschi+femmine) from ".$prefix."_ele_voti_parziale as t1 , ".$prefix."_ele_sezioni as t2 where t1.id_cons=$id_cons and t1.id_sez=t2.id_sez and orario='$orario' and data='$data'";
    69                         $query="select sum(t1.maschi+t1.femmine)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos";               
     86                        $sql="select sum(t1.maschi+t1.femmine)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' and t3.data='$data' and t3.orario='$orario' $circos";         
    7087                       
    71                         if ($genere==0){$query.=" and id_gruppo=$id_gruppo";}
    72                         $res1234=mysql_query($query, $dbi);
    73                         list($tot)=mysql_fetch_row($res1234);
     88                        if ($genere==0){$sql.=" and id_gruppo=$id_gruppo";}
     89                                $res1234 = $dbi->prepare("$sql");
     90                                $res1234->execute();
     91
     92                        list($tot)=$res1234->fetch(PDO::FETCH_NUM);
    7493                        if ($tot)
    7594                        $perc=number_format($voti_t*100/$tot,2);
    76                         else {$tot=0;$perc="0.00";}                                                                                                                                     echo "<table class=\"td-80\"><tr class=\"bggray\">";
     95                        else {$tot=0;$perc="0.00";}                                                                                                                                     
     96                        echo "<table class=\"td-80\"><tr class=\"bggray\">";
    7797                        if ($genere==0){echo "<td>N.</td>";}
    78                         echo "<td><b>"._VOTANTI."</b></td><td><b>"._PERCE."</b></td>";
    79                         echo "<td><b>"._SEZIONI."</b></td>";
    80                         echo "</tr>";
     98                                echo "<td><b>"._VOTANTI."</b></td><td><b>"._PERCE."</b></td>";
     99                                echo "<td><b>"._SEZIONI."</b></td>";
     100                                echo "</tr>";
    81101                        echo "<tr class=\"bggray2\">";
    82102                        if ($genere==0){echo "<td>$num_gruppo</td>";}
Note: See TracChangeset for help on using the changeset viewer.