Changeset 257 for trunk/admin/modules/Elezioni/ele_confcons.php
- Timestamp:
- Feb 9, 2019, 8:45:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_confcons.php
r254 r257 15 15 // Offset - visualizza il numero di elementi per pagina 16 16 $offset=5; 17 17 global $db1; 18 18 $aid=$_SESSION['aid']; 19 $dbi=$_SESSION['dbi'];20 19 $prefix=$_SESSION['prefix']; 21 20 $currentlang=$_SESSION['lang']; … … 26 25 27 26 $id_comune=$_SESSION['id_comune']; 28 $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune' " , $dbi); 29 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 27 $sql = "SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune' "; 28 $res = $dbi->prepare("$sql"); 29 $res->execute(); 30 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 30 31 31 32 include("modules/Elezioni/funzionidata.php"); … … 66 67 67 68 //-----------------------visualizza blocco inserimento - 68 $res = mysql_query("SELECT * FROM ".$prefix."_ele_conf", $dbi); //da modificare 69 $max = mysql_num_rows($res); 69 $sql="SELECT * FROM ".$prefix."_ele_conf"; //da modificare 70 $res = $dbi->prepare("$sql"); 71 $res->execute(); 72 $max = $res->rowCount(); 70 73 $nuovo_gruppo=$max+1; 71 74 echo "<form name=\"gruppo2\" enctype=\"multipart/form-data\" action=\"admin.php\" method=\"post\">" 72 75 ."<input type=\"hidden\" name=\"op\" value=\"confconsiglio\">"; 73 76 if ($do=='modify') { 74 $resl = mysql_query("SELECT * FROM ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi); 75 $gru=mysql_fetch_array($resl); 77 $sql="SELECT * FROM ".$prefix."_ele_conf where id_conf='$id_conf'"; 78 $res1 = $dbi->prepare("$sql"); 79 $res1->execute(); 80 $gru=$resl->fetch(PDO::FETCH_BOTH); 76 81 $nuovo_gruppo=$gru['id_conf']; 77 82 echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; … … 85 90 ."<tr><td align=\"center\"><b>"._LIMITE."</b></td><td><select name=\"limite\"><option value=\"0\">"._NOFASCIA; 86 91 87 $result1 = mysql_query("select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf='".$gru['id_conf']."' order by id_fascia", $dbi); 88 while(list($id,$descr)=mysql_fetch_row($result1)){ 89 $sel= ($id == $gru['limite']) ? "selected":""; 90 echo "<option value=\"$id\" $sel>$descr"; 91 } 92 echo "</select></td>"; 92 $sql="select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf='".$gru['id_conf']."' order by id_fascia"; 93 $result1 = $dbi->prepare("$sql"); 94 $result1->execute(); 95 while(list($id,$descr)=$result1->fetch(PDO::FETCH_NUM)){ 96 $sel= ($id == $gru['limite']) ? "selected":""; 97 echo "<option value=\"$id\" $sel>$descr"; 98 } 99 echo "</select></td>"; 93 100 $sel= ($gru['consin']==1) ? "selected":""; 94 101 echo "<td align=\"center\"><b>"._CONSIN."</b></td><td><select name=\"consin\"><option value=\"0\">No<option value=\"1\" $sel>Si</select></td></tr>" … … 116 123 117 124 118 $res = mysql_query("SELECT * FROM ".$prefix."_ele_conf", $dbi); 119 $max = mysql_num_rows($res); 120 $result = mysql_query("select * from ".$prefix."_ele_conf ORDER BY id_conf LIMIT $min,$offset", $dbi); 121 while(list($id_conf,$descrizione,$limite, $consin,$infpremio, $supsbarramento, $suppremio, $listinfsbar, $listinfconta, $listsupconta) = mysql_fetch_row($result)) { 125 $sql="SELECT * FROM ".$prefix."_ele_conf"; 126 $res = $dbi->prepare("$sql"); 127 $res->execute(); 128 $max = $res->rowCount(); 129 $sql="select * from ".$prefix."_ele_conf ORDER BY id_conf LIMIT $min,$offset"; 130 $result = $dbi->prepare("$sql"); 131 $result->execute(); 132 while(list($id_conf,$descrizione,$limite, $consin,$infpremio, $supsbarramento, $suppremio, $listinfsbar, $listinfconta, $listsupconta) = $result->fetch(PDO::FETCH_NUM)) { 122 133 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 123 134 echo "<tr bgcolor=\"$bgcolor1\"><td align=\"center\"><b>$id_conf</b></td>" … … 179 190 echo "[ <a href=\"admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&id_conf=$id_conf\">"._NO."</a> ] - [<a href=\"admin.php?op=confconsiglio&do=delete&id_conf=$id_conf&id_cons_gen=$id_cons_gen&id_comune=$id_comune&ok=1\">"._YES."</a> ]";exit; 180 191 }else{ 181 $result = mysql_query("delete from ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi); 182 if (!$result) return; 192 $sql="delete from ".$prefix."_ele_conf where id_conf='$id_conf'"; 193 $result = $dbi->prepare("$sql"); 194 $result->execute(); 195 if (!$result->rowCount()) return; 183 196 Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&id_conf=$id_conf&min=$min"); 184 197 } … … 186 199 if ($descrizione) { 187 200 $sqlset=''; 188 $result = mysql_query("insert into ".$prefix."_ele_conf(id_conf,descrizione, limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,infminpremio,supminpremio) values ('$id_conf','$descrizione','$limite','$consin','$infpremio','$supsbarramento','$suppremio','$listinfsbar','$listinfconta','$listsupconta','$infminpremio','$supminpremio')", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error()); 189 if (!$result) return; 201 $sql="insert into ".$prefix."_ele_conf(id_conf,descrizione, limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,infminpremio,supminpremio) values ('$id_conf','$descrizione','$limite','$consin','$infpremio','$supsbarramento','$suppremio','$listinfsbar','$listinfconta','$listsupconta','$infminpremio','$supminpremio')"; 202 $result = $dbi->prepare("$sql"); 203 $result->execute(); 204 if (!$result->rowCount()) return; 190 205 Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&min=$min"); 191 206 } else { … … 197 212 } 198 213 } elseif ($do == "update") { 199 $result = mysql_query("update ".$prefix."_ele_conf set descrizione='$descrizione', limite='$limite', consin='$consin', infpremio='$infpremio', supsbarramento='$supsbarramento', suppremio='$suppremio', listinfsbar='$listinfsbar', listinfconta='$listinfconta', listsupconta='$listsupconta', infminpremio='$infminpremio', supminpremio='$supminpremio' where id_conf='$id_conf' ", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error()); 214 $sql="update ".$prefix."_ele_conf set descrizione='$descrizione', limite='$limite', consin='$consin', infpremio='$infpremio', supsbarramento='$supsbarramento', suppremio='$suppremio', listinfsbar='$listinfsbar', listinfconta='$listinfconta', listsupconta='$listsupconta', infminpremio='$infminpremio', supminpremio='$supminpremio' where id_conf='$id_conf' "; 215 $result = $dbi->prepare("$sql"); 216 $result->execute(); 200 217 Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&min=$min"); 201 218 }
Note:
See TracChangeset
for help on using the changeset viewer.