📄 function.dbx-error.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Report the error message of the latest function call in the module</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-connect.html">dbx_connect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div> <div class="up"><a href="ref.dbx.html">dbx Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.dbx-error" class="refentry"> <div class="refnamediv"> <h1 class="refname">dbx_error</h1> <p class="verinfo">(PHP 4 >= 4.0.6, PHP 5 <= 5.0.5, PECL dbx:1.1.0)</p><p class="refpurpose"><span class="refname">dbx_error</span> — <span class="dc-title"> Report the error message of the latest function call in the module </span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><b>dbx_error</b></b></span> ( <span class="methodparam"><span class="type">object</span> <tt class="parameter">$link_identifier</tt></span> )</div> <p class="para rdfs-comment"> <b>dbx_error()</b> returns the last error message. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">link_identifier</tt></i></span> <dd> <p class="para"> The DBX link object returned by <a href="function.dbx-connect.html" class="function">dbx_connect()</a> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</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 <i><tt class="parameter">link_identifier</tt></i> parameter. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>dbx_error()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$link </span><span style="color: #007700">= </span><span style="color: #0000BB">dbx_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">DBX_MYSQL</span><span style="color: #007700">, </span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"db"</span><span style="color: #007700">, </span><span style="color: #DD0000">"username"</span><span style="color: #007700">, </span><span style="color: #DD0000">"password"</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Could not connect"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">dbx_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">, </span><span style="color: #DD0000">"select id from non_existing_table"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$result </span><span style="color: #007700">== </span><span style="color: #0000BB">0</span><span style="color: #007700">) {<br /> echo </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">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: Always refer to the module-specific documentation as well. <br /> The error message for Microsoft SQL Server is actually the result of the <a href="function.mssql-get-last-message.html" class="function">mssql_get_last_message()</a> function. <br /> The error message for Oracle (oci8) is not implemented yet. <br /> </p></blockquote> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-connect.html">dbx_connect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div> <div class="up"><a href="ref.dbx.html">dbx Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -