Ignore:
Timestamp:
Jan 16, 2019, 7:06:35 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/ele.php

    r255 r256  
    6464        $bgcolor1='#e7e7e7';
    6565        $row=descr_comune();$descr_comu=$row['descrizione'];
    66 #       $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'";
    67 #       $res = mysql_query($sqlcomu);
    68 #       list($descr_comu)=mysql_fetch_row($res);
    69         $sqlcomu="select fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
    70         $res = mysql_query($sqlcomu);
    71         if ($res)
    72         list($fascia)=mysql_fetch_row($res);
     66
     67        $row=daticonscom();
     68        if ($row['fascia']) $fascia=$row['fascia'];
    7369        else
    7470        $fascia=0;
     
    109105        // controllo delle opzioni utilizzabili: sono quelle che hanno genitori in quella precedente
    110106        // esempio si possono inserire i candidati solo se prima sono state inserite le liste
    111         $resq = mysql_query("select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons", $dbi);
    112         if ($resq) list($nrcirco)=mysql_fetch_row($resq); else $nrcirco=0;
    113         $resq = mysql_query("select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi);
    114         if ($resq) list($nrsede)=mysql_fetch_row($resq); else $nrsede=0;
    115         $resq = mysql_query("select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi);
    116         if ($resq) list($nrgruppo)=mysql_fetch_row($resq); else $nrgruppo=0;
    117         $resq = mysql_query("select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons", $dbi);
    118         if ($resq) list($nrlista)=mysql_fetch_row($resq); else $nrlista=0;
    119         $resq = mysql_query("SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons", $dbi);
    120         if ($resq) list($nraff)=mysql_fetch_row($resq); else $nraff=0;
     107        $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons";
     108        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrcirco=$row[0];}
     109        catch(PDOException $e) {$nrcirco=0; }   
     110        $sql="select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons";
     111        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrsede=$row[0];}
     112        catch(PDOException $e) {$nrsede=0; }   
     113        $sql="select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons";
     114        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrgruppo=$row[0];}
     115        catch(PDOException $e) {$nrgruppo=0; }         
     116        $sql = "select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons";
     117        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrlista=$row[0];}
     118        catch(PDOException $e) {$nrlista=0; }   
     119        $sql = "SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons";
     120        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $nraff=$row[0];}
     121        catch(PDOException $e) {$nraff=0; }     
    121122        if ($genere==0) $tmpval='voti_ref'; else $tmpval='sezioni';
    122         $resq = mysql_query("SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons", $dbi);
    123         if ($resq) list($nrvoti)=mysql_fetch_row($resq); else $nrvoti=0;
    124         unset($resq);
     123        $sql = "SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons";
     124        try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrvoti=$row[0];}
     125        catch(PDOException $e) {$nrvoti=0; }   
     126        unset($row);
    125127        if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare
    126128        {
     
    178180
    179181                <a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
    180                 <a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br/>
     182                <a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br>
    181183                <a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a>
    182184                </td></tr>";
Note: See TracChangeset for help on using the changeset viewer.