php-doc-en/reference/ovrimos/functions/ovrimos-result-all.xml
Hartmut Holzgraefe 5b9fc29465 revision tags added
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78496 c90b9560-bf6c-de11-be94-00142212c4b1
2002-04-17 06:45:35 +00:00

134 lines
3.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/ovrimos.xml, last change in rev 1.1 -->
<refentry id="function.ovrimos-result-all">
<refnamediv>
<refname>ovrimos_result_all</refname>
<refpurpose>
Prints the whole result set as an HTML table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</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>
<function>ovrimos_result_all</function> is used to print an HTML
table containing the whole result set.
</para>
<para>
<function>ovrimos_result_all</function> prints the whole result
set as an HTML table. Returns &true; or
&false;.
</para>
<para>
<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>
This will execute an SQL statement and print the result in an
HTML table.
</para>
<para>
<example>
<title>Ovrimos_result_all 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>
<para>
<example>
<title>ovrimos_result_all example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = ovrimos_connect ("db_host", "8001", "admin", "password");
if ($conn != 0) {
echo "Connection ok!";
$res = ovrimos_exec ($conn, "update test set i=5");
if ($res != 0) {
echo "Statement ok!";
echo ovrimos_num_rows ($res)." rows affected\n";
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
-->