PHP mysqli_connect_errno() Function
Definition
The mysqli_connect_errno() function returns the error code from the last connection error.
Syntax
PHP mysqli_connect_errno() Function has the following syntax.
mysqli_connect_errno();
Return
An error code value for the last call to mysqli_connect(), if it failed. zero means no error occurred.
Example
Get the error code from the last connection error
<?php/*from w w w . jav a 2 s . c o m*/
$con=mysqli_connect("localhost","wrong_user","my_wrongPassword","my_WrongDatabase");
// Check connection
if (!$con){
die("Connection error: " . mysqli_connect_errno());
}
?>