I am trying to understand how the result set is extracted from the OCIFetchstatement function. The PHP manual has this routine:
$nrows = OCIFetchStatement($stmt,$results);
if ( $nrows > 0 ) {
print "<TABLE BORDER="1">n";
print "<TR>n";
while ( list( $key, $val ) = each( $results ) ) {
print "<TH>$key</TH>n";
}
print "</TR>n";

for ( $i = 0; $i < $nrows; $i++ ) {
reset($results);
print "<TR>n";
while ( $column = each($results) ) {
$data = $column['value'];
print "<TD>$data[$i]</TD>n";
}
print "</TR>n";
}
print "</TABLE>n";
} else {
echo "No data found<BR>n";
}

I am having trouble understanding the second each() function. The first each funtion retrieves the key (column name) and val (array of the enture result set in column order) because it can equate $key and $val to something in $results.

The second each statement ($column = each($results) has me confused. How does each() equate $column to a row from the result set?
Besides column, what other fields reside in $result?

Thanks