Example
Return an error code from the last connection error, if any:
<?php
$con=mysqli_connect("localhost","wrong_user","my_password","my_db");
// Check connection
if (!$con)
{
die("Connection error: " . mysqli_connect_errno());
}
?>
Definition and Usage
The mysqli_connect_errno() function returns the error code from the last connection error, if any.
Syntax
mysqli_connect_errno();
Technical Details
Return Value: | Returns an error code value. Zero if no error occurred |
---|---|
PHP Version: | 5+ |
< PHP MySQLi Reference