Latest web development tutorials

PHP mysqli_connect_errno () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Examples

Returns the last connection error error code:

<? 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 ());
}
?>

Definition and Usage

mysqli_connect_errno () function to return the last connection error error code.


grammar

mysqli_connect_errno() ;

technical details

return value: Returns an error code value if no error occurs 0 is returned.
PHP version: 5+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual