Changeset 257 for trunk/admin/modules/Elezioni/ele_sede.php
- Timestamp:
- Feb 9, 2019, 8:45:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_sede.php
r80 r257 23 23 if ($perms>16) { 24 24 25 $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); 26 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 25 $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'"; 26 $res = $dbi->prepare("$sql"); 27 $res->execute(); 28 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 27 29 28 30 include("modules/Elezioni/funzionidata.php"); … … 73 75 74 76 if ($id_sede){ 75 $res = mysql_query("SELECT * FROM ".$prefix."_ele_sede where id_sede='$id_sede'", $dbi); 76 $pro= mysql_fetch_array($res, 3); 77 $sql = "SELECT * FROM ".$prefix."_ele_sede where id_sede='$id_sede'"; 78 $res = $dbi->prepare("$sql"); 79 $res->execute(); 80 $pro= $res->fetch(PDO::FETCH_BOTH); 77 81 }else{ 78 82 $pro['indirizzo']='';$pro['filemappa']='';$pro['telefono1']='';$pro['fax']=''; … … 81 85 echo "<tr>"; 82 86 echo "<td align=\"right\"><select name=\"id_circ\">"; 83 $res= mysql_query("SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ", $dbi); 84 while(list($id,$descr) = mysql_fetch_row($res)) { 87 $sql= "SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ"; 88 $res = $dbi->prepare("$sql"); 89 $res->execute(); 90 while(list($id,$descr) = $res->fetch(PDO::FETCH_NUM)) { 85 91 if ($id == $pro['id_circ']) { 86 92 $sel = "selected"; … … 110 116 111 117 112 $res = mysql_query("SELECT * FROM ".$prefix."_ele_sede where id_cons='$id_cons' ", $dbi); 113 $max = mysql_num_rows($res); 114 $result = mysql_query("select * from ".$prefix."_ele_sede where id_cons='$id_cons' ORDER BY id_circ LIMIT $min,$offset", $dbi); 115 while(list($id_cons2,$id_sede,$id_circ,$indir, $tel1, $tel2, $fax, $resp,$mappabin, $filemappa) = mysql_fetch_row($result)) { 118 $sql = "SELECT * FROM ".$prefix."_ele_sede where id_cons='$id_cons' "; 119 $res = $dbi->prepare("$sql"); 120 $res->execute(); 121 $max = $res->rowCount(); 122 $sql = "select * from ".$prefix."_ele_sede where id_cons='$id_cons' ORDER BY id_circ LIMIT $min,$offset"; 123 $result = $dbi->prepare("$sql"); 124 $result->execute(); 125 while(list($id_cons2,$id_sede,$id_circ,$indir, $tel1, $tel2, $fax, $resp,$mappabin, $filemappa) = $result->fetch(PDO::FETCH_NUM)) { 116 126 // dati circoscrizione 117 $restemp = mysql_query("select count(0) from ".$prefix."_ele_sezioni where id_sede='$id_sede'", $dbi); 118 list($numtemp)=mysql_fetch_row($restemp); 119 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 120 $result1 = mysql_query("select descrizione from ".$prefix."_ele_circoscrizione where id_circ='$id_circ'", $dbi); 121 list($descr_circ)=mysql_fetch_row($result1); 122 echo "<tr bgcolor=\"$bgcolor1\"><td align=\"left\"><b>$descr_circ</b>" 123 ."</td><td align=\"left\"><b>$indir</b>" 124 ."</td><td align=\"right\"><b>$filemappa</b>" 125 ."</td><td align=\"right\"><b>$tel1</b>" 126 ."</td><td align=\"right\"><b>$fax</b>" 127 ."</td><td align=\"left\"><b>$resp</b>" 128 ."</td><td align=\"center\" nowrap>[<a 127 $sql = "select count(0) from ".$prefix."_ele_sezioni where id_sede='$id_sede'"; 128 $restemp = $dbi->prepare("$sql"); 129 $restemp->execute(); 130 list($numtemp)=$restemp->fetch(PDO::FETCH_NUM); 131 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 132 $sql="select descrizione from ".$prefix."_ele_circoscrizione where id_circ='$id_circ'"; 133 $result1 = $dbi->prepare("$sql"); 134 $result1->execute(); 135 list($descr_circ)=$result1->fetch(PDO::FETCH_NUM); 136 echo "<tr bgcolor=\"$bgcolor1\"><td align=\"left\"><b>$descr_circ</b>" 137 ."</td><td align=\"left\"><b>$indir</b>" 138 ."</td><td align=\"right\"><b>$filemappa</b>" 139 ."</td><td align=\"right\"><b>$tel1</b>" 140 ."</td><td align=\"right\"><b>$fax</b>" 141 ."</td><td align=\"left\"><b>$resp</b>" 142 ."</td><td align=\"center\" nowrap>[<a 129 143 href=\"admin.php?op=sede&do=modify&id_sede=$id_sede&id_circ=$id_circ&id_cons_gen=$id_cons_gen\"><img src=\"modules/Elezioni/images/edit.gif\" 130 144 border=\"0\" align=\"middle\" alt=\"edit\"> "._EDIT."</a>]"; … … 182 196 die(); 183 197 }else{ 184 $result = mysql_query("delete from ".$prefix."_ele_sede where id_sede='$id_sede'", $dbi); 185 if (!$result)return; 198 $sql="delete from ".$prefix."_ele_sede where id_sede='$id_sede'"; 199 $res = $dbi->prepare("$sql"); 200 $res->execute(); 201 if (!$res->rowCount())return; 186 202 Header("Location: admin.php?op=sede&id_cons_gen=$id_cons_gen"); 187 203 } … … 211 227 212 228 213 $result = mysql_query("insert into ".$prefix."_ele_sede (id_cons,id_circ,indirizzo,telefono1,telefono2,fax,responsabile,mappa,filemappa) values ('$id_cons', '$id_circ','$indir','$tel1','$tel2', '$fax','$resp','$mappablob','$mappanome')", $dbi)|| die(mysql_error()); 214 if (!$result) return; 229 $sql="insert into ".$prefix."_ele_sede (id_cons,id_circ,indirizzo,telefono1,telefono2,fax,responsabile,mappa,filemappa) values ('$id_cons', '$id_circ','$indir','$tel1','$tel2', '$fax','$resp','$mappablob','$mappanome')"; 230 $res = $dbi->prepare("$sql"); 231 $res->execute(); 232 if (!$res->rowCount()) return; 215 233 Header("Location: admin.php?op=sede&id_cons_gen=$id_cons_gen"); 216 234 } else { … … 237 255 } else {$cond='';} 238 256 239 $result = mysql_query("update ".$prefix."_ele_sede set id_circ='$id_circ',indirizzo='$indir' , telefono1='$tel1', telefono2='$tel2',fax='$fax',responsabile='$resp' $cond where id_sede='$id_sede2' ", $dbi)|| die(mysql_error()); 240 if (!$result) return; 241 Header("Location: admin.php?op=sede&id_cons_gen=$id_cons_gen&id_comune=$id_comune"); 257 $sql="update ".$prefix."_ele_sede set id_circ='$id_circ',indirizzo='$indir' , telefono1='$tel1', telefono2='$tel2',fax='$fax',responsabile='$resp' $cond where id_sede='$id_sede2' "; 258 $res = $dbi->prepare("$sql"); 259 $res->execute(); 260 if (!$res->rowCount()) return; 261 Header("Location: admin.php?op=sede&id_cons_gen=$id_cons_gen&id_comune=$id_comune"); 242 262 } 243 263 }
Note:
See TracChangeset
for help on using the changeset viewer.