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

    r145 r265  
    2222$now = $now . $gmtstr;
    2323// comune
    24 $res = mysql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ", $dbi);
    25         list($descr_com) = mysql_fetch_row($res);
     24$sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
     25$res = $dbi->prepare("$sql");
     26$res->execute();
     27
     28        list($descr_com) = $res->fetch(PDO::FETCH_NUM);
    2629
    2730
     
    8689        if ($genere==4){$tab="ele_voti_lista";}
    8790        if ($votog){$tab="ele_voti_lista";}
    88         $res = mysql_query("select *  from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez ",$dbi);
    89        
    90         if ($res) $numero=mysql_num_rows($res);else $numero=0;
    91         $res = mysql_query("select t2.*  from ".$prefix."_ele_sezioni as t2, ".$prefix."_ele_sede as t1 where t2.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circondt1",$dbi);
    92         if ($res) $sezioni=mysql_num_rows($res);else $sezioni=0;
     91        $sql="select *  from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez ";
     92        $res = $dbi->prepare("$sql");
     93        $res->execute();
     94
     95       
     96        if ($res) $numero=$res->rowCount();else $numero=0;
     97        $sql="select t2.*  from ".$prefix."_ele_sezioni as t2, ".$prefix."_ele_sede as t1 where t2.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circondt1";
     98        $res = $dbi->prepare("$sql");
     99        $res->execute();
     100
     101        if ($res) $sezioni=$res->rowCount();else $sezioni=0;
    93102       
    94103        if ($numero>0){
     
    96105                // tot voti
    97106                        if (!$circo)
    98                                 $restotv = mysql_query("select sum(voti)  from ".$prefix."_$tab where id_cons=$id_cons ",  $dbi);
     107                                $sql="select sum(voti)  from ".$prefix."_$tab where id_cons=$id_cons ";
    99108                        if ($votog)
    100                                 $restotv = mysql_query("select sum(voti)  from ".$prefix."_ele_voti_lista where id_cons=$id_cons ",  $dbi);     
    101                         list($tot)  = mysql_fetch_row($restotv);
     109                                $sql="select sum(voti)  from ".$prefix."_ele_voti_lista where id_cons=$id_cons ";       
     110                        $restotv = $dbi->prepare("$sql");
     111                        $restotv->execute();
     112                        list($tot)  = $restotv->fetch(PDO::FETCH_NUM);
    102113                       
    103114                        $i=0;
     
    107118                                if ($votog){
    108119                               
    109                                 $res = mysql_query("select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma
     120                                $sql="select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma
    110121                                from ".$prefix."_ele_gruppo as t1,
    111122                                ".$prefix."_ele_voti_lista as t2,
     
    115126                                and t1.id_gruppo=t3.id_gruppo
    116127                                group by t1.id_gruppo
    117                                 order by somma desc", $dbi);$cosa='id_gruppo';
     128                                order by somma desc";
     129                                $res = $dbi->prepare("$sql");
     130                                $res->execute();
     131                                $cosa='id_gruppo';
    118132                               
    119133                                }else{
    120134                               
    121135                       
    122                                 $res = mysql_query("select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma
     136                                $sql="select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma
    123137                                from ".$prefix."_ele_gruppo as t1
    124138                                left join ".$prefix."_$tab as t2 on (t1.id_gruppo=t2.id_gruppo)
    125139                                where   t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circondt1
    126140                                group by t2.id_gruppo
    127                                 order by somma desc", $dbi);$cosa='id_gruppo';
     141                                order by somma desc";
     142                                $res = $dbi->prepare("$sql");
     143                                $res->execute();
     144                                $cosa='id_gruppo';
    128145                               }
    129146                       
    130147                       
    131148                        }else{
    132                                 $res = mysql_query("select t1.id_lista, t1.num_lista, t1.descrizione, sum(t2.voti) as somma
     149                                $sql="select t1.id_lista, t1.num_lista, t1.descrizione, sum(t2.voti) as somma
    133150                                from ".$prefix."_ele_lista as t1
    134151                        left join ".$prefix."_$tab as t2 on (t1.id_lista=t2.id_lista)
    135152                                where   t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons
    136153                                group by t2.id_lista
    137                                 order by somma desc", $dbi);$cosa='id_lista';
     154                                order by somma desc";
     155                                $res = $dbi->prepare("$sql");
     156                                $res->execute();
     157                                $cosa='id_lista';
    138158                        }
    139159
     
    142162                                $gruppinum=mysql_num_rows($res);
    143163                                $altrivoti=0;
    144                                 while (list($id,$num,$descrizione,$voti)  = mysql_fetch_row($res)){
     164                                while (list($id,$num,$descrizione,$voti)  = $res->fetch(PDO::FETCH_NUM)){
    145165
    146166                               
Note: See TracChangeset for help on using the changeset viewer.