Easy Tutorial
❮ Func String Sprintf Func Curl_Error ❯

PHP mysqli_connect_errno() Function

PHP MySQLi Reference Manual

Example

Returns the error code from the last connection error:

<?php
$con = mysqli_connect("localhost", "wrong_user", "my_password", "my_db");
// Check if the connection was successful
if (!$con) {
    die("Connection failed: " . mysqli_connect_errno());
}
?>

Definition and Usage

The mysqli_connect_errno() function returns the error code from the last connection error.


Syntax

Technical Details

Return Value: Returns the error code value, or 0 if no error occurred.
PHP Version: 5+
--- ---
❮ Func String Sprintf Func Curl_Error ❯