PHP mysqli_error() Function

Object oriented style

string $mysqli->error;

Procedural style

string mysqli_error ( mysqli $link )

The mysqli_error() function returns the last error description for the most recent function call, if any.

Returns the last error message for the most recent MySQLi function call that can succeed or fail.

Examples -

Object oriented style

Procedural style

The above examples will output:

Errormessage: Unknown system variable 'a'

ParameterDescription
linkProcedural style only: A link identifier returned by mysqli_connect() or mysqli_init()

A string that describes the error. An empty string if no error occurred.