Ignore:
Timestamp:
Mar 30, 2022, 2:56:01 PM (3 years ago)
Author:
roby
Message:

adeguamento di alcune query alla direttiva sql_mode=only_full_group_by di mysql, sistemazione di alcuni bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/temi/Futura2/function_theme.php

    r362 r364  
    3939
    4040
    41         $sql="select t1.* from ".$prefix."_ele_voti_".$tab." as t1 left join ".$prefix."_ele_$tab as t2 on t1.id_$tab=t2.id_$tab where t1.id_cons='$id_cons' $circos group by t1.id_sez ";
    42                 $res = $dbi->prepare("$sql");
    43                 $res->execute();
     41        $sql="select t1.id_sez from ".$prefix."_ele_voti_".$tab." as t1 left join ".$prefix."_ele_$tab as t2 on t1.id_$tab=t2.id_$tab where t1.id_cons='$id_cons' $circos group by t1.id_sez ";
     42        $res = $dbi->prepare("$sql");
     43        $res->execute();
    4444        if($res)
    4545                $numero=$res->rowCount();
     
    4747        $numero=1;
    4848        $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";
    49                 $res = $dbi->prepare("$sql");
    50                 $res->execute();
     49        $res = $dbi->prepare("$sql");
     50        $res->execute();
    5151        $sezioni=$res->rowCount();
    5252        if ($numero!=0){
     
    187187        if ($genere==4 or $visgralista){$tab="ele_voti_lista";}
    188188        if ($votog){$tab="ele_voti_lista";}
    189         $sql="select * from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez ";
    190                 $res = $dbi->prepare("$sql");
    191                 $res->execute();
     189        $sql="select id_sez from ".$prefix."_$tab where id_cons='$id_cons' group by id_sez ";
     190        $res = $dbi->prepare("$sql");
     191        $res->execute();
    192192        if ($circo){
    193193                $sql="select t1.*  from ".$prefix."_ele_voti_gruppo as t1, ".$prefix."_ele_gruppo as t2 where t1.id_gruppo=t2.id_gruppo and t1.id_cons='$id_cons' and t2.id_circ=$id_circ group by t1.id_sez ";
     
    248248                                left join ".$prefix."_$tab as t2 on (t1.id_gruppo=t2.id_gruppo)
    249249                                where   t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circondt1
    250                                 group by t2.id_gruppo
     250                                group by t1.id_gruppo, t1.num_gruppo, t1.descrizione
    251251                                order by somma desc";
    252252                                $cosa='id_gruppo';
     
    474474        if ($circo) $circos = "and id_circ=$id_circ" ; else $circos='';
    475475        if ($genere==0) $tab="ref"; else $tab="gruppo";
    476         $sql="select * from ".$prefix."_ele_voti_".$tab." where id_cons='$id_cons'  $circos group by id_sez ";
    477                                 $res = $dbi->prepare("$sql");
    478                                 $res->execute();
     476        $sql="select id_sez from ".$prefix."_ele_voti_".$tab." where id_cons='$id_cons'  $circos group by id_sez ";
     477        $res = $dbi->prepare("$sql");
     478        $res->execute();
    479479        $numero=$res->rowCount();
    480480        $sql="select *  from ".$prefix."_ele_sezioni where id_cons='$id_cons' $circos ";
    481                                 $res = $dbi->prepare("$sql");
    482                                 $res->execute();
     481        $res = $dbi->prepare("$sql");
     482        $res->execute();
    483483        $sezioni=$res->rowCount();
    484484        //$res = mysql_query("select chiusa  from ".$prefix."_ele_cons_comuni where id_cons='$id_cons' $circos ",$dbi);
     
    606606                                left join ".$prefix.$scelta."
    607607                                where t1.id_cons='$id_cons'
    608                                 group by t2.id_cand
    609                                  
    610                                 order by somma desc
    611                                
    612                                 ";
     608                                group by t1.id_lista, t1.id_cand, t1.nome, t1.cognome
     609                                order by somma desc";
    613610                        $res = $dbi->prepare("$sql");
    614611                        $res->execute();
     
    679676
    680677        // numero sezioni
    681         $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 ";
     678        $sql="select t3.id_sez  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 ";
    682679        $sez_num = $dbi->prepare("$sql");
    683680        $sez_num->execute();
     
    11351132       
    11361133
    1137                 $sql="select t3.*  from ".$prefix."_ele_voti_parziale 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' and t3.data='$data' and t3.orario='$orario'  group by t3.id_sez ";
     1134                $sql="select t3.id_sez from ".$prefix."_ele_voti_parziale 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' and t3.data='$data' and t3.orario='$orario' group by t3.id_sez ";
    11381135                $res1 = $dbi->prepare("$sql");
    11391136                $res1->execute();
     
    12151212if ($genere==0) $tab="ref";
    12161213
    1217         $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 ";
     1214        $sql="select t3.id_sez 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 ";
    12181215        $res = $dbi->prepare("$sql");
    12191216        $res->execute();
Note: See TracChangeset for help on using the changeset viewer.