PHP mysqli_connect_errno() Function
In this chapter you will learn:
- Definition for PHP mysqli_connect_errno() Function
- Syntax for PHP mysqli_connect_errno() Function
- Return for PHP mysqli_connect_errno() Function
- Example - Get the error code from the last connection error
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 j a v a 2s.com
$con=mysqli_connect("localhost","wrong_user","my_wrongPassword","my_WrongDatabase");
// Check connection
if (!$con){
die("Connection error: " . mysqli_connect_errno());
}
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_connect_error() Function
- Syntax for PHP mysqli_connect_error() Function
- Return for PHP mysqli_connect_error() Function
- Example - Get the error description from the last connection error
Home » PHP Tutorial » PHP MySQLi Functions