uTools-Manuals/docs/php/pg_fetch_all.html
2019-04-08 23:22:26 +08:00

43 lines
3.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>从结果中提取所有行作为一个数组</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.pg-fetch-all" class="refentry">
<div class="refnamediv">
<h1 class="refname">pg_fetch_all</h1>
<p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pg_fetch_all</span> &mdash; <span class="dc-title">从结果中提取所有行作为一个数组</span></p>
</div>
<div class="refsect1 unknown-seealsp" id="refsect1-function.pg-fetch-all-unknown-seealsp">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>pg_fetch_all</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result</code></span>
) : <span class="type">array</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>pg_fetch_all()</strong></span>
从结果资源中返回一个包含有所有的行(元组/记录)的数组。如果没有更多行可供提取,则返回 <strong><code>FALSE</code></strong>
</p>
<p class="para">
<div class="example" id="example-2488">
<p><strong>Example #1 <span class="function"><strong>pg_fetch_all()</strong></span> 例子</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_pconnect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=publisher"</span><span style="color: #007700">);<br />if&nbsp;(!</span><span style="color: #0000BB">$conn</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"An&nbsp;error&nbsp;occured.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />}<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;authors"</span><span style="color: #007700">);<br />if&nbsp;(!</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"An&nbsp;error&nbsp;occured.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />}<br /></span><span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_fetch_all</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$arr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
<p class="para">
参见 <span class="function"><a href="pg_fetch_row.html" class="function">pg_fetch_row()</a></span><span class="function"><a href="pg_fetch_array.html" class="function">pg_fetch_array()</a></span><span class="function"><a href="pg_fetch_object.html" class="function">pg_fetch_object()</a></span>
<span class="function"><a href="pg_fetch_result.html" class="function">pg_fetch_result()</a></span>
</p>
</div>
</div></div></div></body></html>