Returns the error code of the last connection error:
<?php $con = mysqli_connect ( " localhost " , " wrong_user " , " my_password " , " my_db " ) ; // Check whether the connection is successful if ( ! $con ) { die ( " Connection failed: " . mysqli_connect_errno ( ) ) ; } ?>The mysqli_connect_errno() function returns the error code of the last connection error.
mysqli_connect_errno() ;
| Return value: | Returns an error code value, or 0 if no error occurred. |
|---|---|
| PHP version: | 5+ |