Hi, basically OCIFetchStatement fetches the complete results of your SELECT into an array. Suppose you have the following SQL: SELECT firstname, lastname, emp_id from employees now your $results array will look like this: $results["firstname"][0]="Florian" $results["lastname"][0] = "Clever" $results[emp_id"][0]=1 $results["firstname"][1]="John" $results["lastname"][1] = "Asendorf" $results[emp_id"][1]=1 So the first loop goes through and displays the $results array's keys, which are the column headers of your SELECT statement. The for-loop loops through all rows and siplays each row of your SELECT. the while loop in that for-loop again loops through each element (to be specific each SELECT column) and displays it's value. BTW: I would not really use this code to display big result sets, because Oracle has to return all rows (OPTIMIZER=ALL_ROWS) before execution can continue after the OCIFetchStatement. Other approcaches, with each row at a time will allow PHP to continue before Oracle actually fetched all values. Florian ---------------- John Asendorf wrote: I yanked this example off of the annotated manual and I'm trying to figure out how/why one of the statements works... The example puts all of the results from an Oracle select statement in to a table. I can make it work, but I want to customize it. Unfortunately I think I may just be too inexperienced to figure out what the hell is going on... I get everything up until the second "while" statement. Can anyone explain to me what it's doing? Would it be a bit easier to understand if $column was renamed $row? Is that more accurate? What if I wanted to format the data? Would something like: print "$data['row_name'], $data['row_name2'] $data[3] <br>"; work? Maybe I'm way ahead of myself here... anyone? thanks in advance John $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"; --------------------- John Asendorf - [EMAIL PROTECTED] Web Applications Developer http://www.lcounty.com - NEW FEATURES ADDED DAILY! Licking County, Ohio, USA 740-349-3631 Aut insanit homo, aut versus facit -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]