Trying to understand this example

From: Date: Tue, 20 Feb 2001 19:41:12 +0000
Subject: Trying to understand this example
Groups: php.windows 
Request: Send a blank email to php-windows+get-5665@lists.php.net to get a copy of this message
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 - jasendorf@lcounty.com Web Applications Developer http://www.lcounty.com - NEW FEATURES ADDED DAILY! Licking County, Ohio, USA 740-349-3631 Aut insanit homo, aut versus facit

« previous php.windows (#5665) next »