Example
Return an error description 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_error());
}
?>
Definition and Usage
The mysqli_connect_error() function returns the error description from the last connection error, if any.
Syntax
mysqli_connect_error();
Technical Details
Return Value: | Returns a string that describes the error. NULL if no error occurred |
---|---|
PHP Version: | 5+ |
< PHP MySQLi Reference