false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
$sql = "use $dbname";
$dbi->exec($sql);
}
catch(PDOException $e)
{
echo $sql . "
" . $e->getMessage();
}
$fase=intval($_GET['fase']);
if ($fase=='1'){
$sql="SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione";
$res = $dbi->prepare("$sql");
$res->execute();
Header("content-type: application/x-javascript");
echo "document.write(\"";
$res = $dbi->prepare("$sql");
$res->execute();
while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) {
echo "";
}
echo "\")";
}elseif ($fase=='2'){
$id_cons_gen2=intval($_GET['id_cons_gen2']);
$sql="SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'";
$rescons = $dbi->prepare("$sql");
$rescons->execute();
list($descr_cons) = $rescons->fetch(PDO::FETCH_NUM);
$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 ";
$res = $dbi->prepare("$sql");
$res->execute();
Header("content-type: application/x-javascript");
echo "document.write(\"";
echo "\")";
}
?>