php-doc-en/reference/oci8/functions/ocifetchstatement.xml
Damien Seguy c4720092de erm, tags...
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@126323 c90b9560-bf6c-de11-be94-00142212c4b1
2003-05-09 01:35:24 +00:00

114 lines
3.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/oci8.xml, last change in rev 1.2 -->
<refentry id="function.ocifetchstatement">
<refnamediv>
<refname>ocifetchstatement</refname>
<refpurpose>Fetch all rows of result data into an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ocifetchstatement</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
<methodparam><type>array &amp;</type><parameter>variable</parameter></methodparam>
<methodparam><type>int</type><parameter>skip</parameter></methodparam>
<methodparam><type>int</type><parameter>maxrows</parameter></methodparam>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
<function>ocifetchstatement</function> fetches all the rows from a
result into a user-defined array.
<function>ocifetchstatement</function> returns the number of rows
fetched. <parameter>skip</parameter> is the number of initial rows
to ignore when fetching the result (default value of 0, to start
at the first line). <parameter>maxrows</parameter> is the number of
rows to read, starting at the <parameter>skip</parameter>th row
(Default to -1, meaning all the rows).
</para>
<para>
<parameter>flags</parameter> represents the available options for,
which can be any combinaisons of the following :
<simplelist>
<member>
<constant>OCI_FETCHSTATEMENT_BY_ROW</constant>
</member>
<member>
<constant>OCI_FETCHSTATEMENT_BY_COLUMN</constant> (default value)
</member>
<member>
<constant>OCI_NUM</constant>
</member>
<member>
<constant>OCI_ASSOC</constant>
</member>
</simplelist>
</para>
<para>
<example>
<title><function>ocifetchstatement</function> example</title>
<programlisting>
<![CDATA[
<?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);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->