oci_fetch_array

2019. 5. 16. 16:02developer

<?php

$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 department_id, department_name FROM departments');
oci_execute($stid);

while ((
$row oci_fetch_array($stidOCI_BOTH)) != false) {
    
// Use the uppercase column names for the associative array indices
    
echo $row[0] . " and " $row['DEPARTMENT_ID']   . " are the same<br>\n";
    echo 
$row[1] . " and " $row['DEPARTMENT_NAME'] . " are the same<br>\n";
}

oci_free_statement($stid);
oci_close($conn);

?>