Changeset 265 for trunk/client/modules/Elezioni/blocchi/off_Votanti.php
- Timestamp:
- Apr 13, 2019, 8:05:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/blocchi/off_Votanti.php
r2 r265 22 22 # $numero=mysql_num_rows($res); 23 23 # $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(); 28 34 29 35 if ($numero!=0){ … … 36 42 37 43 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); 40 49 if ($genere!=0) { 41 50 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, 43 52 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 45 57 }else{ 46 $ res1 = mysql_query("SELECT sum(validi+nulli+bianchi+contestati) as tot,58 $sql="SELECT sum(validi+nulli+bianchi+contestati) as tot, 47 59 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 49 64 } 50 65 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)){ 52 67 $tot_votanti=$validi+$bianchi+$nulli+$contestati; 53 68 $perc_validi=number_format($validi*100/$tot_votanti,2); … … 60 75 61 76 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); 64 82 } 65 83
Note:
See TracChangeset
for help on using the changeset viewer.