Easy Tutorial
❮ Func String Lcfirst Func String Strncasecmp ❯

PHP mysqli_error_list() Function

PHP MySQLi Reference Manual

Example

Returns the last error code from the most recent function call:

<?php
// Assuming database username: root, password: 123456, database: tutorialpro
$con = mysqli_connect("localhost", "root", "123456", "tutorialpro");
if (mysqli_connect_errno($con)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// Perform a query, check for errors
if (!mysqli_query($con, "INSERT INTO websites (name) VALUES ('tutorialpro.org')")) {
    print_r(mysqli_error_list($con));
}

mysqli_close($con);
?>

Definition and Usage

The mysqli_error_list() function returns a list of errors from the most recent function call.


Syntax

Parameter Description
connection Required. Specifies the MySQL connection to use.

Technical Details

Return Value: Returns a list of errors. Each error is an associative array containing 'errno' (error code), 'error' (error text), and 'sqlstate'.
PHP Version: 5.4+
--- ---

❮ Func String Lcfirst Func String Strncasecmp ❯