PHP mysqli_connect_error () function
Examples
Returns the last connection error error description:
<? php
$ con = mysqli_connect ( "localhost" , "wrong_user", "my_password", "my_db");
// Check the connection
if (! $ con)
{
die ( "Connection Error:" mysqli_connect_error ();.
}
?>
$ con = mysqli_connect ( "localhost" , "wrong_user", "my_password", "my_db");
// Check the connection
if (! $ con)
{
die ( "Connection Error:" mysqli_connect_error ();.
}
?>
Definition and Usage
mysqli_connect_error () function to return the last connection error error description.
grammar
mysqli_connect_error() ;
technical details
return value: | Returns a string describing the error. If no error occurs returns NULL. |
---|---|
PHP version: | 5+ |
PHP MySQLi Reference Manual