ocifetchstatement
(PHP 4, PHP 5, PECL oci8:1.0-1.2.4)
ocifetchstatement — Estrae tutte le tuple in un array
Descrizione
int ocifetchstatement
( resource $stmt
, array & $variable
)
ocifetchstatement() estrae tutte le tuple da un risultato ponendole in un array definito dall'utente. ocifetchstatement() restituisce il numero di tuple estratte.
Example#1 Esempio di ocifetchstatement()
<?php
/* OCIFetchStatement example mbritton@verinet.com (990624) */
$conn = OCILogon("scott","tiger");
$stmt = OCIParse($conn,"select * from emp");
OCIExecute($stmt);
$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";
}
print "$nrows Records Selected<BR>\n";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>