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

Legend:

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

    r2 r265  
    2222#       $numero=mysql_num_rows($res);
    2323#       $res = mysql_query("select *  from ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
    24         $res = mysql_query("select t3.*  from ".$prefix."_ele_voti_".$tab." 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' $circos  group by t3.id_sez ",$dbi);
    25         $numero=mysql_num_rows($res);
    26         $res = 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);
    27         $sezioni=mysql_num_rows($res);
     24        $sql="select t3.*  from ".$prefix."_ele_voti_".$tab." 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' $circos  group by t3.id_sez ";
     25        $res = $dbi->prepare("$sql");
     26        $res->execute();
     27
     28        $numero=$res->rowCount();
     29        $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";
     30        $res = $dbi->prepare("$sql");
     31        $res->execute();
     32
     33        $sezioni=$res->rowCount();
    2834       
    2935        if ($numero!=0){
     
    3642
    3743
    38         $res1 = mysql_query("SELECT sum(t1.maschi+t1.femmine) 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);
    39         list($tot_aventi)  = mysql_fetch_row($res1);
     44        $sql="SELECT sum(t1.maschi+t1.femmine) 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";
     45        $resl = $dbi->prepare("$sql");
     46        $resl->execute();
     47
     48        list($tot_aventi)  = $res1->fetch(PDO::FETCH_NUM);
    4049        if ($genere!=0) {
    4150
    42                 $res1 = mysql_query("SELECT sum(t1.validi+t1.nulli+t1.bianchi+t1.contestati) as tot,
     51                $sql="SELECT sum(t1.validi+t1.nulli+t1.bianchi+t1.contestati) as tot,
    4352                sum(t1.validi),sum(t1.nulli),sum(t1.bianchi),sum(t1.contestati), '0'
    44                 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 having tot>0",$dbi);
     53                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 having tot>0";
     54        $resl = $dbi->prepare("$sql");
     55        $resl->execute();
     56
    4557        }else{
    46                 $res1 = mysql_query("SELECT sum(validi+nulli+bianchi+contestati) as tot,
     58                $sql="SELECT sum(validi+nulli+bianchi+contestati) as tot,
    4759                sum(validi),sum(nulli),sum(bianchi),sum(contestati), id_gruppo
    48                 from ".$prefix."_ele_voti_ref  where id_cons=$id_cons group by id_gruppo having tot>0",$dbi);
     60                from ".$prefix."_ele_voti_ref  where id_cons=$id_cons group by id_gruppo having tot>0";
     61        $resl = $dbi->prepare("$sql");
     62        $resl->execute();
     63
    4964        }
    5065
    51         while  (list($tot_votanti,$validi,$nulli,$bianchi,$contestati,$id)  = mysql_fetch_row($res1)){
     66        while  (list($tot_votanti,$validi,$nulli,$bianchi,$contestati,$id)  = $res1->fetch(PDO::FETCH_NUM)){
    5267                $tot_votanti=$validi+$bianchi+$nulli+$contestati;
    5368                $perc_validi=number_format($validi*100/$tot_votanti,2);
     
    6075
    6176                if ($genere==0) {
    62                         $res = mysql_query("SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id",$dbi);
    63                         list($num_gruppo,$descr_gruppo)  = mysql_fetch_row($res);
     77                        $sql="SELECT num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id";
     78        $res = $dbi->prepare("$sql");
     79        $res->execute();
     80
     81                        list($num_gruppo,$descr_gruppo)  = $res->fetch(PDO::FETCH_NUM);
    6482                }
    6583                 
Note: See TracChangeset for help on using the changeset viewer.