Skip to content

MySQL_GetConnectionError

imshooter edited this page Oct 24, 2026 · 1 revision

The message of the last time the handle failed to connect.

native bool:MySQL_GetConnectionError(MySQL:handle, error[], size = sizeof (error));

Parameters

Parameter Description Default
MySQL:handle Handle to check.
error[] Array for the message.
size Size of the array. sizeof (error)

Returns

  • true when the message was written.
  • false when the handle does not exist.

Example

stock ReportConnection(MySQL:handle) {
    new
        error[128]
    ;

    if (MySQL_IsConnected(handle)) {
        print("Connected.");

        return;
    }

    MySQL_GetConnectionError(handle, error);
    printf("Not connected, error %i: %s", MySQL_GetConnectionErrno(handle), error);
}

Related

Clone this wiki locally