php8.5
Home/ Manual/ cubrid / functions/ cubrid_error_code

cubrid_error_code

PHP function Edit on GitHub ✎

(PECL CUBRID >= 8.3.0)

Get error code for the most recent function call

Description

cubrid_error_code(): int

The cubrid_error_code() function is used to get the error code of the error that occurred during the API execution. Usually, it gets the error code when API returns false as its return value.

Parameters Parameters

Return Values

Error code of the error that occurred, or 0 (zero) if no error occurred.

Examples

cubrid_error_code() example

php
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$req = cubrid_prepare($conn , "SELECT * FROM code WHERE s_name=?");

$req = @cubrid_execute($req);
if (!$req) {
    printf("Error facility: %d\nError code: %d\nError msg: %s\n",
        cubrid_error_code_facility(), cubrid_error_code(), cubrid_error_msg());

    cubrid_disconnect($conn);
    exit;
}
?>

The above example will output:

output
Error facility: 4
Error code: -30015
Error msg: Some parameter not binded

See Also

Source: reference/cubrid/functions/cubrid-error-code.xml · from the official PHP manual (php/doc-en)