|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-29 21:01 UTC] jani@php.net
[2008-07-29 21:04 UTC] djneoform at gmail dot com
[2008-08-20 02:19 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 12:00:02 2025 UTC |
Description: ------------ When a mysqli connection fails, the returned value is an empty mysqli object and not a bool(FALSE), this means any tests on the connection will not work, eg: if ($conn) { ... } When the documentation: http://ca.php.net/manual/en/mysqli.connect.php States: "Return Values Returns a object which represents the connection to a MySQL Server or FALSE if the connection failed." Reproduce code: --------------- <?php $connection = new mysqli('localhost', 'badinfo', 'badinfo', 'badinfo'); var_dump($connection); ?> Expected result: ---------------- bool(FALSE) Actual result: -------------- object(mysqli)#1 (0) { }