PHP mysqli_connect_error() Function

Object oriented style

string $mysqli->connect_error;

Procedural style

string mysqli_connect_error ( void )

Returns the last error message string from the last call to mysqli_connect().

The mysqli_connect_error() function returns the error description from the last connection error, if any.

Example -

Object oriented style

Procedural style

The above examples will output:

Connect Error: Access denied for user 'fake_user'@'localhost' (using password: YES)

Return Values

A string that describes the error. NULL is returned if no error occurred.