uTools-Manuals/docs/php/dbx_error.html
2019-04-28 19:00:34 +08:00

93 lines
5.1 KiB
HTML

<!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>Report the error message of the latest function call in the module</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.dbx-error" class="refentry">
<div class="refnamediv">
<h1 class="refname">dbx_error</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5 &lt; 5.1.0, PECL dbx &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">dbx_error</span> &mdash; <span class="dc-title">
Report the error message of the latest function call in the module
</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.dbx-error-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>dbx_error</strong></span>
( <span class="methodparam"><span class="type">object</span> <code class="parameter">$link_identifier</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>dbx_error()</strong></span> returns the last error message.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.dbx-error-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">link_identifier</code></dt>
<dd>
<p class="para">
The DBX link object returned by <span class="function"><a href="dbx_connect.html" class="function">dbx_connect()</a></span>
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.dbx-error-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns a string containing the error message from the last function call
of the abstracted module (e.g. mysql module). If there are multiple
connections in the same module, just the last error is given. If there are
connections on different modules, the latest error is returned for the
module specified by the <code class="parameter">link_identifier</code> parameter.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.dbx-error-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-972">
<p><strong>Example #1 <span class="function"><strong>dbx_error()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$link&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">DBX_MYSQL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Could&nbsp;not&nbsp;connect"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;id&nbsp;from&nbsp;non_existing_table"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">dbx_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">dbx_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.dbx-error-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
Always refer to the module-specific documentation as well.
</p>
<p class="para">
The error message for <span class="productname">Microsoft SQL Server</span> is actually the result
of the <span class="function"><a href="mssql_get_last_message.html" class="function">mssql_get_last_message()</a></span> function.
</p>
<p class="para">
The error message for Oracle (oci8) is not implemented yet.
</p>
</p></blockquote>
</div>
</div></div></div></body></html>