PHP mysqli_connect_error() returns the error description from the last connection error.
Syntax
string mysqli_connect_error(void);
Parameter | Description |
---|---|
NA : | NA |
Return Values : | Return string that describes the error. NULL is returned if no error occurred. |
<?php $con = mysqli_connect("localhost","user","password","db"); if (!$con) { die('Connect Error: ' . mysqli_connect_error()); } mysqli_close($con); ?>