$conn=oci_connect('hr','welcome','localhost/XE');
if (!$conn) {$e=oci_error();trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);
}$stid=oci_parse($conn,'SELECT POSTAL_CODE, CITY FROM locations WHERE ROWNUM
echo"$nrowsrows fetched
n";var_dump($res);// var_dump output is:
// 2 rows fetched
// array(2) {
// ["POSTAL_CODE"]=>
// array(2) {
// [0]=>
// string(6) "00989x"
// [1]=>
// string(6) "10934x"
// }
// ["CITY"]=>
// array(2) {
// [0]=>
// string(4) "Roma"
// [1]=>
// string(6) "Venice"
// }
// }
// Pretty-print the resultsecho"
foreach ($resas$col) {
echo"
n";foreach ($colas$item) {
echo"
".($item!==null?htmlentities($item,ENT_QUOTES) :"")."n";}
echo"
n";}
echo"
n";oci_free_statement($stid);oci_close($conn);?>