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

    r137 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                $sezioni=$res2->rowCount();
     22
     23    $sql="select orario,data  from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order  by data desc,orario desc limit 1";
     24        $res = $dbi->prepare("$sql");
     25        $res->execute();
     26
    2127    if($res){
    2228
    23         while(list($orario,$data) = mysql_fetch_row($res)) {
     29        while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) {
    2430                list ($ore,$minuti,$secondi)=explode(':',$orario);
    2531                list ($anno,$mese,$giorno)=explode('-',$data);
     
    2733       
    2834
    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);
     35                $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 ";
     36        $resl = $dbi->prepare("$sql");
     37        $resl->execute();
     38
     39                $numero=$res1->rowCount();
    3140       
    3241                echo "<h5>Ultime Affluenze</h5>";
     
    3847#               $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);
    3948 #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);
     49if($genere==0)         
     50        $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 " ;
    4151else
    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);
     52        $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";
     53$resl = $dbi->prepare("$sql");
     54$resl->execute();
     55
    4356#fine modifica
    4457                                                                                                                                     
     
    4760               
    4861                                                                                                                             
    49                 while(list($voti_t, $num_gruppo,$id_gruppo) = mysql_fetch_row($res1)) {
     62                while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) {
    5063
    51                         $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";               
    52                         if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";}
    53                         $res_aff=mysql_query($query, $dbi);
    54                         $voti_numero=mysql_num_rows($res_aff);
     64                        $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";         
     65            if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";}
     66                        $res_aff = $dbi->prepare("$sql");
     67                        $res_aff->execute();
     68
     69                        $voti_numero=$res_aff->rowCount();
    5570               
    56                         $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";               
     71                        $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";         
    5772                       
    5873                        if ($genere==0){$query.=" and id_gruppo=$id_gruppo";}
    59                         $res1234=mysql_query($query, $dbi);
    60                         list($tot)=mysql_fetch_row($res1234);
     74                        $res1234 = $dbi->prepare("$sql");
     75                        $res1234->execute();
     76
     77                        list($tot)=$res1234->fetch(PDO::FETCH_NUM);
    6178                        if ($tot)
    6279                            $perc=number_format($voti_t*100/$tot,2);
Note: See TracChangeset for help on using the changeset viewer.