RE: [PHP-WIN] Trying to understand this example

From: Date: Wed, 21 Feb 2001 17:56:11 +0000
Subject: RE: [PHP-WIN] Trying to understand this example
Groups: php.windows 
Request: Send a blank email to php-windows+get-5678@lists.php.net to get a copy of this message
Since our external email was down all morning, I worked this out.. funny you mentioning print vs. echo... I prefer echo too.. echo "<TABLE BORDER=\"0\" width=\"100%\">\n"; echo "<TR>\n"; echo "<TD>Name</TD><TD>Address</TD><TD>City</TD>\n"; echo "</TR>\n"; while ( OCIFetchInto ( $stmt_search , $results ) ) { echo "<TR>\n"; echo "<TD><a href=\"dl_post_2.php?input_customer=$results[0]\">$results[1]</a></TD> \n<TD>$results[2] <br> $results[3]</TD> \n<TD>$results[4]</TD>\n"; echo "</TR>\n";} } echo "</TABLE>\n"; What I finally realized was that I was looking at the example in an entirely wrong light. Once I figured out the difference between FetchStatement and FetchInto, the solution became much more obvious. Thanks for trying to explain it to me. --------------------- 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 > -----Original Message----- > From: Tom Mathews [mailto:tpm@st.com] > Sent: Wednesday, February 21, 2001 4:15 AM > To: Asendorf, John > Subject: Re: [PHP-WIN] Trying to understand this example > > > John > > You're (mis) understanding should all be cleared up by > knowing what the 'each' > keyword does. > Column is not a misnomer at all, what it does is cycle > through a single row, > pulling out one entry for each column. > Thus the first while loops through the columns of the first > row - the row > titles > the for loop then cycles through all the rows, one at a time > the second while cycles through the columns of the $ith row > > I'm not going to help you with the print statements - I > personally find them > very unfriendly and prefer to use the echo keyword. Any > formatting I do is > arranged by assigning classes in the style sheet. This tends > (not infallibly) > to produce faster code, and definitely makes it easier to read. > > Tom > > > > > $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 > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > For additional commands, e-mail: php-windows-help@lists.php.net > > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#5678) next »