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/bar_affluenze.php

    r116 r265  
    1515// numero sezioni scrutinate
    1616
    17                 $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);
    18                 $sezioni=mysql_num_rows($res2);
     17                $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";
     18        $res2 = $dbi->prepare("$sql");
     19        $res2->execute();
    1920
    20     $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);
    21     if($res){
     21                $sezioni=$res2->fetch(PDO::FETCH_NUM);
    2222
    23         while(list($orario,$data) = mysql_fetch_row($res)) {
     23    $sql="select orario,data  from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order  by data desc,orario desc limit 1", $dbi);
     24        $res = $dbi->prepare("$sql");
     25        $res->execute();
     26 if($res){
     27
     28        while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) {
    2429                list ($ore,$minuti,$secondi)=explode(':',$orario);
    2530                list ($anno,$mese,$giorno)=explode('-',$data);
     
    2732       
    2833
    29                 $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);
    30                 $numero=mysql_num_rows($res1);
     34                $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 ";
     35                $resl = $dbi->prepare("$sql");
     36                $resl->execute();
     37
     38                $numero=$res1->rowCount();
    3139       
    3240                echo "<h5>Ultime Affluenze</h5>";
     
    3846#               $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);
    3947#modifica del 26giugno 09 per gestione circoscrizionali
    40 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);
     48if($genere==0)         
     49        $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 ";
    4150else
    42                 $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);
     51        $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";
     52$resl = $dbi->prepare("$sql");
     53$resl->execute();
     54
    4355#fine modifica
    4456
     
    4658
    4759
    48                 while(list($voti_t, $num_gruppo,$id_gruppo) = mysql_fetch_row($res1)) {
     60                while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) {
    4961
    50                         $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";               
    51                         if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";}
    52                         $res_aff=mysql_query($query, $dbi);
    53                         $voti_numero=mysql_num_rows($res_aff);
     62                        $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";         
     63                        if ($genere==0){$sql.=" and t3.id_gruppo=$id_gruppo";}
     64                        $res_aff = $dbi->prepare("$sql");
     65                        $res_aff->execute();
     66                        $voti_numero=$res_aff->rowCount();
    5467               
    55                         $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";               
     68                        $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";         
    5669                       
    57                         if ($genere==0){$query.=" and id_gruppo=$id_gruppo";}
    58                         $res1234=mysql_query($query, $dbi);
    59                         list($tot)=mysql_fetch_row($res1234);
     70                        if ($genere==0){$sql.=" and id_gruppo=$id_gruppo";}
     71                        $res1234 = $dbi->prepare("$sql");
     72                        $res1234->execute();
     73                        list($tot)=$res1234->fetch(PDO::FETCH_NUM);
    6074                        if ($tot)
    6175                            $perc=number_format($voti_t*100/$tot,2);
Note: See TracChangeset for help on using the changeset viewer.