Changeset 336 for trunk/admin/modules/Elezioni/ele_desc_fasce.php
- Timestamp:
- Sep 23, 2020, 11:32:27 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_desc_fasce.php
r189 r336 13 13 if (isset($_GET['fascia'])) $fasciacom=intval($_GET['fascia']); else $fasciacom=0; 14 14 include("../../config.php"); 15 $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error()); 16 mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error()); 17 mysql_query("SET NAMES 'utf8'", $dbi); 18 $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi); 19 20 echo "<select name=\"idfascia\">"; 21 echo "<option value=\"0\"> "; 22 $inffascia=0; 23 while(list($id,$abitanti)=mysql_fetch_row($rescomu)){ 24 $sel=''; 25 if ($id == $fasciacom) $sel="selected"; elseif ($id==1) $sel="selected"; 26 echo "<option value=\"$id\" $sel>$inffascia - $abitanti"; 27 $inffascia=$abitanti; 28 } 29 echo "</select>"; 15 try{ 16 $dbi = new PDO("mysql:host=$dbhost;charset=latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); 17 $sql = "use $dbname"; 18 $dbi->exec($sql); 19 } 20 catch(PDOException $e) 21 { 22 echo $sql . "<br>" . $e->getMessage(); 23 } 24 $sql="SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'"; 25 $sth = $dbi->prepare("$sql"); 26 $sth->execute(); 27 echo "<select name=\"idfascia\">"; 28 echo "<option value=\"0\"> "; 29 $inffascia=0; 30 while(list($id,$abitanti)=$sth->fetch(PDO::FETCH_NUM)){ 31 $sel=''; 32 if ($id == $fasciacom) $sel="selected"; elseif ($id==1) $sel="selected"; 33 echo "<option value=\"$id\" $sel>$inffascia - $abitanti"; 34 $inffascia=$abitanti; 35 } 36 echo "</select>"; 30 37 31 38 ?>
Note:
See TracChangeset
for help on using the changeset viewer.