1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
<?
function tira_fuori ($tab) {
$dbserver = "127.0.0.1";
$dbport = "5432";
$database = "odontolinux";
$conn = pg_Connect("host=$dbserver port=$dbport dbname=$database ");
if (!$conn) {
echo "Si è verificato un errore.\n";
exit;
} // Errore accesso al database
pg_Exec($conn,"SET DATESTYLE TO 'European';");
$esito = pg_Exec($conn, "SELECT * FROM $tab WHERE id LIKE '1';");
if (!$esito) {
echo "Si è verificato un errore.\n";
exit;
} // Errore interrogazione database yes
$numerorighe = pg_NumRows($esito);
return array ($numerorighe, $esito);
}
list ($num, $esi) = tira_fuori ("anagrafica");
echo $num;
echo $esi;
// $i = 0;
// while ($i < $num) {
// echo "<B>";
// echo pg_Result($esito, $i, "cognome");
// echo " ";
// echo pg_Result($esito, $i, "nome");
// echo "</B>";
// $i++;
// } // Estrazione delle righe dell'interrogazione
?>
|