<!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><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.maxdb-connect-errno.html">maxdb_connect_errno</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.maxdb-connect.html">maxdb_connect</a></div> <div class="up"><a href="ref.maxdb.html">MaxDB Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.maxdb-connect-error" class="refentry"> <div class="refnamediv"> <h1 class="refname">maxdb_connect_error</h1> <p class="verinfo">(PECL maxdb >= 1.0)</p><p class="refpurpose"><span class="refname">maxdb_connect_error</span> — <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">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>maxdb_connect_error</strong></span> ( <span class="methodparam">void</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="function.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="function.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">Return Values</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">Examples</h3> <p class="para"> <div class="example" id="example-1243"> <p><strong>Example #1 maxdb_connect_error sample</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$link </span><span style="color: #007700">= </span><span style="color: #0000BB">maxdb_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"nonexisting_user"</span><span style="color: #007700">, </span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br />if (!</span><span style="color: #0000BB">$link</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Can't connect to localhost. Error: %s\n"</span><span style="color: #007700">, </span><span style="color: #0000BB">maxdb_connect_error</span><span style="color: #007700">());<br />}<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> <p class="para">The above example will output something similar to:</p> <div class="example-contents screen"> <div class="cdata"><pre> PHP Warning: maxdb_connect(): -4008 POS(1) Unknown user name/password combination <...> Can'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">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.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="function.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="function.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="function.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="function.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><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.maxdb-connect-errno.html">maxdb_connect_errno</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.maxdb-connect.html">maxdb_connect</a></div> <div class="up"><a href="ref.maxdb.html">MaxDB Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>