note 89141 deleted from mysqli.connect-error by danielc
| From: | danielc@php.net | Date: | Thu, 12 Mar 2009 20:51:11 +0000 |
| Subject: | note 89141 deleted from mysqli.connect-error by danielc | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151806@lists.php.net to get a copy of this message | ||
Note Submitter: tom420 dot duhamel at gmail dot com
Reason: 0
----
The object oriented style does not work for connect_error and connect_errno. However, the procedural
style (mysqli_connect_error and mysql_connect_errno) works perfectly and can be mixed in with object
oriented style code.
<?php
$mysqli = new mysqli('localhost', 'user', 'pass', 'db');
if(mysqli_connect_errno())
{
die('MySQL connection error: ' . mysqli_connect_error());
}
?>
mysqli_connect_errno() returns zero on successful connections, an error number otherwise.