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

    r116 r265  
    2121// numero sezioni scrutinate
    2222
    23                 $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);
    24                 $sezioni=mysql_num_rows($res2);
     23                $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";
     24        $res2 = $dbi->prepare("$sql");
     25        $res2->execute();
    2526
    26     $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);
     27                $sezioni=$res2->fetch(PDO::FETCH_NUM);
     28
     29    $sql="select orario,data  from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' order  by data desc,orario desc limit 1";
     30        $res = $dbi->prepare("$sql");
     31        $res->execute();
     32
    2733    if($res){
    2834
    29         while(list($orario,$data) = mysql_fetch_row($res)) {
     35        while(list($orario,$data) = $res->fetch(PDO::FETCH_NUM)) {
    3036                list ($ore,$minuti,$secondi)=explode(':',$orario);
    3137                list ($anno,$mese,$giorno)=explode('-',$data);
     
    3339       
    3440
    35                 $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);
    36                 $numero=mysql_num_rows($res1);
     41                $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 ";
     42        $resl = $dbi->prepare("$sql");
     43        $resl->execute();
     44
     45                $numero=$res1->rowCount();
    3746       
    3847                echo "<h5>Ultime Affluenze</h5>";
     
    4453#               $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);
    4554#modifica del 26giugno 09 per gestione circoscrizionali
    46 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);
    47 else
    48                 $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);
     55if($genere==0)  {       $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 " ;
     56        $resl = $dbi->prepare("$sql");
     57        $resl->execute();
     58
     59                }else{
     60                $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";
     61        $resl = $dbi->prepare("$sql");
     62        $resl->execute();
     63                }
    4964#fine modifica
    5065                                                                                                                                     
     
    5368               
    5469                                                                                                                             
    55                 while(list($voti_t, $num_gruppo,$id_gruppo) = mysql_fetch_row($res1)) {
     70                while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) {
    5671
    57                         $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";               
     72                        $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";         
    5873                        if ($genere==0){$query.=" and t3.id_gruppo=$id_gruppo";}
    59                         $res_aff=mysql_query($query, $dbi);
    60                         $voti_numero=mysql_num_rows($res_aff);
     74                        $res_aff = $dbi->prepare("$sql");
     75                        $res_aff->execute();
     76
     77                        $voti_numero=$res_aff->rowCount();
    6178               
    62                         $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";               
     79                        $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";         
    6380                       
    6481                        if ($genere==0){$query.=" and id_gruppo=$id_gruppo";}
    65                         $res1234=mysql_query($query, $dbi);
    66                         list($tot)=mysql_fetch_row($res1234);
     82        $res1234 = $dbi->prepare("$sql");
     83        $res1234->execute();
     84
     85                        list($tot)=$res1234->fetch(PDO::FETCH_NUM);
    6786                        if ($tot)
    6887                            $perc=number_format($voti_t*100/$tot,2);
Note: See TracChangeset for help on using the changeset viewer.