$AS400 = 'GESPER_DAT';
$connect = @odbc_connect ($AS400, $_SESSION['user'], $_SESSION['password']);
//In base all'area recupera i campi delle presenze da utilizzare
$area = $_SESSION['area'];
$data = $_POST['Data'];
print "Area: <b>$area</b><br>";
print "Data: <b>".$_POST['Data']."</b><br>";
$sql = "SELECT tcnmpr FROM tabcom00f WHERE tcarea = '$area'";
$rs=odbc_exec($connect,$sql);
$i = 1;
$fields = "";
// Controllo che sulla tabella ci siano dati
if ($rs ==0)
echo ("<B>Error ".odbc_error().":".odbc_errormsg()."</B>");
else if (odbc_num_rows($rs)==0)
print "<BR><B>Nessun dato trovato<br></B>";
else{
$r = 0;
while ($riga=odbc_fetch_object($rs)){
if ($r==0) $fields = trim($riga->TCNMPR);
else $fields = $fields.", ".trim($riga->TCNMPR);
$r++;
}
}