Test de connexion PHP - Oracle
$sql
$nrows Records Selected
\n";
if ( $nrows > 0 ) {
print "
\n";
print "";
while ( list( $key, $val ) = each( $results ) ) {
print "$key | ";
}
print "
\n";
for ( $i = 0; $i < $nrows; $i++ ) {
reset($results);
print "";
while ( $column = each($results) ) {
$data = $column['value'];
print "$data[$i] | ";
}
print "
\n";
}
print "
\n";
} else {
echo "No data found
\n";
}
}
oci_close($conn);
}
else echo " oci_connect ERREUR\n";
print "\nConnexion pdo_oci\n";
try {
$db = new PDO ("oci:dbname=" . ADDR, USER, PASS);
printf("Connecté\n");
foreach ($db->query("SELECT * FROM dept") as $Row)
printf ("%d : %s, %s\n", $Row["DEPTNO"], $Row["DNAME"], $Row["LOC"]);
}
catch(PDOException $e) {
printf("ERREUR : %s\n", $e->getMessage());
}
?>