Changeset 265 for trunk/client/modules/Elezioni/funzioni.php
- Timestamp:
- Apr 13, 2019, 8:05:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/modules/Elezioni/funzioni.php
r242 r265 259 259 260 260 261 $res = mysql_query("select * from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez ",$dbi); 262 263 if ($res) $numero=mysql_num_rows($res);else $numero=0; 264 $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); 265 if ($res) $sezioni=mysql_num_rows($res);else $sezioni=0; 261 $sql="select * from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez "; 262 $res = $dbi->prepare("$sql"); 263 $res->execute(); 264 265 266 if ($res) $numero=$res->rowCount();else $numero=0; 267 $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"; 268 $res = $dbi->prepare("$sql"); 269 $res->execute(); 270 271 if ($res) $sezioni=$res->rowCount();else $sezioni=0; 266 272 if ($numero>0){ 267 273 if ($genere!=0){ 268 $restotv = mysql_query("select sum(voti) from ".$prefix."_$tab where id_cons='$id_cons' ", $dbi); 269 list($tot) = mysql_fetch_row($restotv); 274 $sql="select sum(voti) from ".$prefix."_$tab where id_cons='$id_cons' "; 275 $restotv = $dbi->prepare("$sql"); 276 $restotv->execute(); 277 278 list($tot) = $restotv->fetch(PDO::FETCH_NUM); 270 279 $i=0; 271 280 // lista o gruppo 272 281 if ($genere!=4){ 273 282 if ($votog){ 274 $ res = mysql_query("select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma283 $sql="select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma 275 284 from ".$prefix."_ele_gruppo as t1, 276 285 ".$prefix."_ele_voti_lista as t2, … … 280 289 and t1.id_gruppo=t3.id_gruppo 281 290 group by t1.id_gruppo 282 order by somma desc" , $dbi);291 order by somma desc"; 283 292 }else{ 284 $ res = mysql_query("select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma293 $sql="select t1.id_gruppo, t1.num_gruppo, t1.descrizione, sum(t2.voti) as somma 285 294 from ".$prefix."_ele_gruppo as t1 286 295 left join ".$prefix."_ele_voti_gruppo as t2 on (t1.id_gruppo=t2.id_gruppo) 287 296 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circondt1 288 297 group by t2.id_gruppo 289 order by somma desc" , $dbi);298 order by somma desc"; 290 299 } 291 300 }else{ 292 $ res = mysql_query("select t1.id_lista, t1.num_lista, t1.descrizione, sum(t2.voti) as somma301 $sql="select t1.id_lista, t1.num_lista, t1.descrizione, sum(t2.voti) as somma 293 302 from ".$prefix."_ele_lista as t1 294 303 left join ".$prefix."_$tab as t2 on (t1.id_lista=t2.id_lista) 295 304 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons 296 305 group by t2.id_lista 297 order by somma desc" , $dbi);306 order by somma desc"; 298 307 } 299 $gruppinum=mysql_num_rows($res); 308 $res = $dbi->prepare("$sql"); 309 $res->execute(); 310 $gruppinum=$res->rowCount(); 300 311 $altrivoti=0; 301 312 ###### gestione percentuali … … 303 314 $arval=array(); 304 315 $arvaltot=0; 305 while (list($id,$num,$descrizione,$voti) = mysql_fetch_row($res)){316 while (list($id,$num,$descrizione,$voti) = $res->fetch(PDO::FETCH_NUM)){ 306 317 $arval[$id]=$voti; 307 318 $arvaltot+=$voti; 308 319 } 309 320 $arperc=arrayperc($arval,$arvaltot); 310 mysql_data_seek($res,0); 311 while (list($id,$num,$descrizione,$voti) = mysql_fetch_row($res)){ 321 $res = $dbi->prepare("$sql"); 322 $res->execute(); 323 while (list($id,$num,$descrizione,$voti) = $res->fetch(PDO::FETCH_NUM)){ 312 324 // funz per il taglio corretto della frase 13 feb 2007 313 325 $descrizione=substr($descrizione,0,20); … … 366 378 if($pos=="dx") $p=0; elseif($pos=="sx")$p=1;else $p=''; 367 379 368 $resblk = mysql_query("SELECT * FROM ".$prefix."_ele_widget where pos_or='$p' and attivo='1' order by pos_ver asc", $dbi); 369 if($resblk){ 370 while ($row = mysql_fetch_array($resblk)) { 380 $sql="SELECT * FROM ".$prefix."_ele_widget where pos_or='$p' and attivo='1' order by pos_ver asc"; 381 $res = $dbi->prepare("$sql"); 382 $res->execute(); 383 if($res->rowCount()){ 384 while ($row = $res->fetch(PDO::FETCH_BOTH)) { 371 385 $nome=$row['nome_file']; 372 386 include ("modules/Elezioni/blocchi/$nome"); … … 380 394 if($pos=="dx") $p=0; elseif($pos=="sx")$p=1;else $p=''; 381 395 382 $reschk = mysql_query("SELECT * FROM ".$prefix."_ele_widget where pos_or='$p' and attivo='1' order by pos_ver asc", $dbi); 383 if ($reschk) $numero=mysql_num_rows($reschk);else $numero=0; 396 $sql="SELECT * FROM ".$prefix."_ele_widget where pos_or='$p' and attivo='1' order by pos_ver asc"; 397 $res = $dbi->prepare("$sql"); 398 $res->execute(); 399 if ($res) $numero=$res->rowCount();else $numero=0; 384 400 385 401 return $numero; … … 436 452 }else{ 437 453 438 $res = mysql_query("SELECT simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ", $dbi); 439 list($simbolo,$stemma) = mysql_fetch_row($res); 454 $sql="SELECT simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' "; 455 $res = $dbi->prepare("$sql"); 456 $res->execute(); 457 list($simbolo,$stemma) = $res->fetch(PDO::FETCH_NUM); 440 458 if($simbolo!=''){ 441 459 if (!file_exists("modules/Elezioni/images/$simbolo")) { … … 461 479 global $prefix,$dbi,$id_cons,$limite,$fascia,$ops; 462 480 #voti di lista e di gruppo completamente disgiunti 463 $result = mysql_query("select infdisgiunto, supdisgiunto from ".$prefix."_ele_conf as t2 left join ".$prefix."_ele_cons_comune as t1 on t1.id_conf=t2.id_conf where id_cons = '$id_cons' ", $dbi); 481 $sql="select infdisgiunto, supdisgiunto from ".$prefix."_ele_conf as t2 left join ".$prefix."_ele_cons_comune as t1 on t1.id_conf=t2.id_conf where id_cons = '$id_cons' "; 482 $result = $dbi->prepare("$sql"); 483 $result->execute(); 464 484 $glsep=''; 465 485 if ($result) { 466 list($infdis,$supdis)= mysql_fetch_row($result);486 list($infdis,$supdis)=$result->fetch(PDO::FETCH_NUM); 467 487 if((($fascia>$limite and $supdis) or ($fascia<$limite and $infdis)) and $ops==3) 468 488 $glsep='_lista';
Note:
See TracChangeset
for help on using the changeset viewer.