mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
* Fixes #45646 (Failed Connect Does Not Return FALSE)
* Add a notice about dealing with connection error handling git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@265153 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
0cac5f6eb9
commit
6acd92e24c
1 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry xml:id="mysqli.connect" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::__construct</refname>
|
||||
|
@ -109,8 +109,7 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a object which represents the connection to a MySQL Server or
|
||||
&false; if the connection failed.
|
||||
Returns a object which represents the connection to a MySQL Server.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -124,7 +123,7 @@
|
|||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* check connection */
|
||||
if (mysqli_connect_errno()) {
|
||||
if ($mysqli->connect_error) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
@ -168,6 +167,14 @@ Host information: Localhost via UNIX socket
|
|||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
OO syntax only: If a connection fails an object is still returned. To check
|
||||
if the connection failed then use the <link
|
||||
linkend="mysqli.connect-error">mysqli->connect_error</link> property like in
|
||||
the examples above.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Error "Can't create TCP/IP socket (10106)" usually means that the <link
|
||||
|
|
Loading…
Reference in a new issue