PHP mysqli_connect_errno()Function
Examples
Returns the error code of the last connection error:
$con=mysqli_connect("localhost","wrong_user","my_password","my_db");
//Check whether the connection is successful
if (!$con)
{
die("Connection failed:" . mysqli_connect_errno());
}
Definition and Usage
The mysqli_connect_errno() function returns the error code of the last connection error.
Syntax
mysqli_connect_errno();
Technical Details
| Return value: | Returns the error code value, or 0 if no error occurs. |
|---|---|
| PHP Version: | 5+ |
PHP MySQLi Reference Manual Other Extensions