php-doc-en/reference/ovrimos/functions/ovrimos-result-all.xml
Hannes Magnusson c030e2adf7 Upgrade to DocBook5:
- All id attributes are now xml:id
 - Add docbook namespace to all root elements
 - Replace <ulink /> with <link xlink:href />
 - Minor markup fixes here and there


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-20 22:25:43 +00:00

140 lines
3.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<refentry xml:id="function.ovrimos-result-all" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ovrimos_result_all</refname>
<refpurpose>Prints the whole result set as an HTML table</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>ovrimos_result_all</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>format</parameter></methodparam>
</methodsynopsis>
<para>
Prints the whole result set as an HTML table.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result_id</parameter></term>
<listitem>
<para>
A result identifier, returned by <function>ovrimos_execute</function>
or <function>ovrimos_exec</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>format</parameter></term>
<listitem>
<para>
Optional HTML attributes for the generated table element.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of rows in the generated table.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
This will execute an SQL statement and print the result in an
HTML table.
<example>
<title>Prepare a statement, execute, and view the result</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = ovrimos_connect("db_host", "8001", "admin", "password");
if ($conn != 0) {
echo "Connection ok!";
$res = ovrimos_prepare($conn, "select table_id, table_name
from sys.tables where table_id = 7");
if ($res != 0) {
echo "Prepare ok!";
if (ovrimos_execute($res, array(3))) {
echo "Execute ok!\n";
ovrimos_result_all($res);
} else {
echo "Execute not ok!";
}
ovrimos_free_result($res);
} else {
echo "Prepare not ok!\n";
}
ovrimos_close($conn);
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>ovrimos_result_all</function> with meta-information</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = ovrimos_connect("db_host", "8001", "admin", "password");
if ($conn != 0) {
echo "Connection ok!";
$res = ovrimos_exec($conn, "select table_id, table_name
from sys.tables where table_id = 1");
if ($res != 0) {
echo "Statement ok! cursor=" . ovrimos_cursor($res) . "\n";
$colnb = ovrimos_num_fields($res);
echo "Output columns=" . $colnb . "\n";
for ($i=1; $i <= $colnb; $i++) {
$name = ovrimos_field_name($res, $i);
$type = ovrimos_field_type($res, $i);
$len = ovrimos_field_len($res, $i);
echo "Column " . $i . " name=" . $name . " type=" . $type . " len=" . $len . "\n";
}
ovrimos_result_all($res);
ovrimos_free_result($res);
}
ovrimos_close($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
-->