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

79 lines
4.7 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>Returns a string description of the last connect error</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.maxdb-connect-error" class="refentry">
<div class="refnamediv">
<h1 class="refname">maxdb_connect_error</h1>
<p class="verinfo">(PECL maxdb &gt;= 1.0)</p><p class="refpurpose"><span class="refname">maxdb_connect_error</span> &mdash; <span class="dc-title">Returns a string description of the last connect error</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.maxdb-connect-error-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>maxdb_connect_error</strong></span>
( <span class="methodparam">void</span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
The <span class="function"><strong>maxdb_connect_error()</strong></span> function is identical to the corresponding
<span class="function"><a href="maxdb_connect_errno.html" class="function">maxdb_connect_errno()</a></span> function in every way, except instead of returning
an integer error code the <span class="function"><strong>maxdb_connect_error()</strong></span> function will return
a string representation of the last error to occur for the last
<span class="function"><a href="maxdb_connect.html" class="function">maxdb_connect()</a></span> call.
If no error has occurred, this function will return an empty string.
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.maxdb-connect-error-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
A string that describes the error. An empty string if no error occurred.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.maxdb-connect-error-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-1333">
<p><strong>Example #1 maxdb_connect_error sample</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">maxdb_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"nonexisting_user"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$link</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Can't&nbsp;connect&nbsp;to&nbsp;localhost.&nbsp;Error:&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">maxdb_connect_error</span><span style="color: #007700">());<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
<p class="para">以上例程的输出类似于:</p>
<div class="example-contents screen">
<div class="cdata"><pre>
PHP Warning: maxdb_connect(): -4008 POS(1) Unknown user name/password combination &lt;...&gt;
Can&#039;t connect to localhost. Error: POS(1) Unknown user name/password combination
</pre></div>
</div>
</div>
<div class="refsect1 seealso" id="refsect1-function.maxdb-connect-error-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="maxdb_connect.html" class="function" rel="rdfs-seeAlso">maxdb_connect()</a> - Open a new connection to the MaxDB server</span></li>
<li class="member"><span class="function"><a href="maxdb_connect_errno.html" class="function" rel="rdfs-seeAlso">maxdb_connect_errno()</a> - Returns the error code from last connect call</span></li>
<li class="member"><span class="function"><a href="maxdb_errno.html" class="function" rel="rdfs-seeAlso">maxdb_errno()</a> - Returns the error code for the most recent function call</span></li>
<li class="member"><span class="function"><a href="maxdb_error.html" class="function" rel="rdfs-seeAlso">maxdb_error()</a> - Returns a string description of the last error</span></li>
<li class="member"><span class="function"><a href="maxdb_sqlstate.html" class="function" rel="rdfs-seeAlso">maxdb_sqlstate()</a> - Returns the SQLSTATE error from previous MaxDB operation</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>