ocifetchinto
<<<
ocifetchstatement ocifreecollection
>>>

7.72 Oracle 8
7 Index des fonctions
 Manuel PHP

. Introduction
. Pré-requis
. Installation
. Configuration à l'exécution
. Types de ressources
. Constantes prédefinies
. Exemples
. ocibindbyname
. ocicancel
. ocicloselob
. ocicollappend
. ocicollassign
. ocicollassignelem
. ocicollgetelem
. ocicollmax
. ocicollsize
. ocicolltrim
. ocicolumnisnull
. ocicolumname
. ocicolumnprecision
. ocicolumnscale
. ocicolumnsize
. ocicolumntype
. ocicolumntyperaw
. ocicommit
. ocidefinebyname
. ocierror
. ociexecute
. ocifetch
. ocifetchinto
->ocifetchstatement
. ocifreecollection
. ocifreecursor
. ocifreedesc
. ocifreestatement
. ociinternaldebug
. ociloadlob
. ocilogoff
. ocilogon
. ocinewcollection
. ocinewcursor
. ocinewdescriptor
. ocinlogon
. ocinumcols
. ociparse
. ociplogon
. ociresult
. ocirollback
. ocirowcount
. ocisavelob
. ocisavelobfile
. ociserverversion
. ocisetprefetch
. ocistatementtype
. ociwritelobtofile
. ociwritetemporarylob

7.72.31 ocifetchstatement()Retourne toutes les lignes d'un résultat Oracle

[ Exemples avec ocifetchstatement ]   PHP 3>= 3.0.8, PHP 4

int  ocifetchstatement ( resource   stmt , array   &output , int   skip , int   maxrows , int   flags )

ocifetchstatement retourne toutes les lignes d'un résultat dans le tableau variable. ocifetchstatement retourne le nombre de lignes retournées. skip est le nombre de lignes initiales à ignorer (par défaut, 0). maxrows est le nombre de lignes à lire, en commençant à la skip -ième ligne (par défaut, -1, qui représente toute les lignes).

flags représente les options disponibles pour cette fonction, et qui peuvent être la combinaison des constantes suivantes :

  • OCI_FETCHSTATEMENT_BY_ROW
  • OCI_FETCHSTATEMENT_BY_COLUMN (valeur par défaut)
  • OCI_NUM
  • OCI_ASSOC

Exemple avec ocifetchstatement

<?php
$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
"Aucune données trouvées<BR>\n";
}      
print
"$nrows lignes lues<BR>\n";

OCIFreeStatement($stmt);
OCILogoff($conn);
?>

<< ocifetchstatement >>
ocifetchinto Oracle 8 ocifreecollection