|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-11 14:23 UTC] georg@php.net
[2004-09-13 15:24 UTC] Nico dot Laus dot 2001 at gmx dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
Description: ------------ given the example below from the mysqli documentation, I tried to connect to my MySQL server with wrong data to see, what happens, if the connection really fails. unfortunately the constructor does trigger a WARNING itself and does not return FALSE, as documented. The mysqli_connect_errno() does only return 0 and even the $mysqli->errno variable does not have any value. So I cannot find out, if the connect really has failed or not. I'm using MySQL 4.1.4 Reproduce code: --------------- $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } Expected result: ---------------- Connect failed: <error> Actual result: --------------