Changeset 265 for trunk/client/file.php
- Timestamp:
- Apr 13, 2019, 8:05:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/file.php
r33 r265 2 2 3 3 include("config.php"); 4 if(!$dbi = mysql_connect($dbhost, $dbuname, $dbpass)){ 5 die("<center><img src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br><br><b>Ci sono dei problemi di connessione al Server $dbtype, chiediamo scusa per l'inconveniente.<br><br>Provate piu' tardi, Grazie.</b><br><font color=\"#ff0000\">". mysql_error()."</font></center>"); 6 } 4 try{ 5 $dbi = new PDO("mysql:host=$dbhost;charset=latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); 6 $sql = "use $dbname"; 7 $dbi->exec($sql); 8 } 9 catch(PDOException $e) 10 { 11 echo $sql . "<br>" . $e->getMessage(); 12 } 7 13 $fase=intval($_GET['fase']); 8 14 9 if(!mysql_select_db($dbname)){ 10 die("<center><img src=src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br><br><b>Ci sono dei problemi di connessione al DataBase $dbtype, chiediamo scusa per l'inconveniente.<br><br>Provate piu' tardi, Grazie.</b><br><font color=\"#ff0000\">". mysql_error()."</font></center>"); 11 } 12 mysql_query("SET NAMES 'utf8'", $dbi); 15 13 16 if ($fase=='1'){ 14 $res = mysql_query("SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione",$dbi); 17 $sql="SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione"; 18 $res = $dbi->prepare("$sql"); 19 $res->execute(); 20 15 21 Header("content-type: application/x-javascript"); 16 22 echo "document.write(\"<b><select name=\'id_cons_gen2\'>"; 17 23 18 while(list($id_cons_gen2,$descr) = mysql_fetch_row($res)) {24 while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) { 19 25 echo "<option value=\'$id_cons_gen2\'>$descr"; 20 26 } 21 27 echo "</select>"; 22 mysql_data_seek($res,0); 23 while(list($id_cons_gen2,$descr) = mysql_fetch_row($res)) { 28 $res = $dbi->prepare("$sql"); 29 $res->execute(); 30 while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) { 24 31 echo "<input type=\'hidden\' name=\'$id_cons_gen2\' value=\'$descr\'>"; 25 32 } … … 28 35 }elseif ($fase=='2'){ 29 36 $id_cons_gen2=intval($_GET['id_cons_gen2']); 30 $rescons = mysql_query("SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'",$dbi); 31 list($descr_cons) = mysql_fetch_row($rescons); 32 $res = mysql_query("SELECT t2.id_comune,t2.descrizione from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_comuni as t2 on t1.id_comune=t2.id_comune where t1.id_cons_gen=$id_cons_gen2 order by t2.descrizione ",$dbi); 37 $sql="SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'"; 38 $rescons = $dbi->prepare("$sql"); 39 $rescons->execute(); 40 41 list($descr_cons) = $rescons->fetch(PDO::FETCH_NUM); 42 $sql="SELECT t2.id_comune,t2.descrizione from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_comuni as t2 on t1.id_comune=t2.id_comune where t1.id_cons_gen=$id_cons_gen2 order by t2.descrizione "; 43 $res = $dbi->prepare("$sql"); 44 $res->execute(); 45 33 46 Header("content-type: application/x-javascript"); 34 47 echo "document.write(\"<b><input type=\'hidden\' name=\'id_cons_gen2\' value=\'$id_cons_gen2\'><select name=\'id_comune2\'>"; 35 48 36 while(list($id_comune2,$descr) = mysql_fetch_row($res)) {49 while(list($id_comune2,$descr) = $res->fetch(PDO::FETCH_NUM)) { 37 50 echo "<option value=\'$id_comune2\'>$descr"; 38 51 }
Note:
See TracChangeset
for help on using the changeset viewer.