diff --git a/reference/mysqli/mysqli/connect.xml b/reference/mysqli/mysqli/connect.xml index 76c3346ec3..1e8350f8f3 100644 --- a/reference/mysqli/mysqli/connect.xml +++ b/reference/mysqli/mysqli/connect.xml @@ -1,5 +1,5 @@ - + mysqli::__construct @@ -109,8 +109,7 @@ &reftitle.returnvalues; - 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. @@ -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 &reftitle.notes; + + + OO syntax only: If a connection fails an object is still returned. To check + if the connection failed then use the mysqli->connect_error property like in + the examples above. + + Error "Can't create TCP/IP socket (10106)" usually means that the