Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 3423

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>ovrimos_result_all</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Ovrimos SQL Functions"
HREF="ref.ovrimos.html"><LINK
REL="PREVIOUS"
TITLE="ovrimos_prepare"
HREF="function.ovrimos-prepare.html"><LINK
REL="NEXT"
TITLE="ovrimos_result"
HREF="function.ovrimos-result.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.ovrimos-prepare.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.ovrimos-result.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.ovrimos-result-all"
></A
>ovrimos_result_all</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN166836"
></A
><P
>    (PHP 4 &#62;= 4.0.3, PHP 5)</P
>ovrimos_result_all&nbsp;--&nbsp;Prints the whole result set as an HTML table</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN166839"
></A
><H2
>说明</H2
>int <B
CLASS="methodname"
>ovrimos_result_all</B
> ( int result_id [, string format] )<BR
></BR
><P
>&#13;   Prints the whole result set as an HTML table. 
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN166851"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>result_id</CODE
></DT
><DD
><P
>&#13;       A result identifier, returned by <A
HREF="function.ovrimos-execute.html"
><B
CLASS="function"
>ovrimos_execute()</B
></A
>
       or <A
HREF="function.ovrimos-exec.html"
><B
CLASS="function"
>ovrimos_exec()</B
></A
>.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>format</CODE
></DT
><DD
><P
>&#13;       Optional HTML attributes for the generated table element.
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN166867"
></A
><H2
>返回值</H2
><P
>&#13;   Returns the number of rows in the generated table.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN166870"
></A
><H2
>范例</H2
><P
>&#13;   This will execute an SQL statement and print the result in an
   HTML table.
   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN166873"
></A
><P
><B
>例 1. Prepare a statement, execute, and view the result</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$conn </font><font color="#007700">= </font><font color="#0000BB">ovrimos_connect</font><font color="#007700">(</font><font color="#DD0000">"db_host"</font><font color="#007700">, </font><font color="#DD0000">"8001"</font><font color="#007700">, </font><font color="#DD0000">"admin"</font><font color="#007700">, </font><font color="#DD0000">"password"</font><font color="#007700">);<br />if (</font><font color="#0000BB">$conn </font><font color="#007700">!= </font><font color="#0000BB">0</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Connection ok!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$res </font><font color="#007700">= </font><font color="#0000BB">ovrimos_prepare</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">, </font><font color="#DD0000">"select table_id, table_name<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from sys.tables where table_id = 7"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$res </font><font color="#007700">!= </font><font color="#0000BB">0</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Prepare ok!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">ovrimos_execute</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">, array(</font><font color="#0000BB">3</font><font color="#007700">))) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Execute ok!\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_result_all</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Execute not ok!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_free_result</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Prepare not ok!\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_close</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">);<br />}<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN166877"
></A
><P
><B
>例 2. <B
CLASS="function"
>ovrimos_result_all()</B
> with meta-information</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$conn </font><font color="#007700">= </font><font color="#0000BB">ovrimos_connect</font><font color="#007700">(</font><font color="#DD0000">"db_host"</font><font color="#007700">, </font><font color="#DD0000">"8001"</font><font color="#007700">, </font><font color="#DD0000">"admin"</font><font color="#007700">, </font><font color="#DD0000">"password"</font><font color="#007700">);<br />if (</font><font color="#0000BB">$conn </font><font color="#007700">!= </font><font color="#0000BB">0</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Connection ok!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$res </font><font color="#007700">= </font><font color="#0000BB">ovrimos_exec</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">, </font><font color="#DD0000">"select table_id, table_name<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from sys.tables where table_id = 1"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$res </font><font color="#007700">!= </font><font color="#0000BB">0</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Statement ok! cursor=" </font><font color="#007700">. </font><font color="#0000BB">ovrimos_cursor</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">) . </font><font color="#DD0000">"\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$colnb </font><font color="#007700">= </font><font color="#0000BB">ovrimos_num_fields</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Output columns=" </font><font color="#007700">. </font><font color="#0000BB">$colnb </font><font color="#007700">. </font><font color="#DD0000">"\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">1</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700">&lt;= </font><font color="#0000BB">$colnb</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name </font><font color="#007700">= </font><font color="#0000BB">ovrimos_field_name</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$type </font><font color="#007700">= </font><font color="#0000BB">ovrimos_field_type</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$len </font><font color="#007700">= </font><font color="#0000BB">ovrimos_field_len</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Column " </font><font color="#007700">. </font><font color="#0000BB">$i </font><font color="#007700">. </font><font color="#DD0000">" name=" </font><font color="#007700">. </font><font color="#0000BB">$name </font><font color="#007700">. </font><font color="#DD0000">" type=" </font><font color="#007700">. </font><font color="#0000BB">$type </font><font color="#007700">. </font><font color="#DD0000">" len=" </font><font color="#007700">. </font><font color="#0000BB">$len </font><font color="#007700">. </font><font color="#DD0000">"\n"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_result_all</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_free_result</font><font color="#007700">(</font><font color="#0000BB">$res</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">ovrimos_close</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">);<br />}<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.ovrimos-prepare.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.ovrimos-result.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ovrimos_prepare</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.ovrimos.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ovrimos_result</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>