CUBRID Функции
PHP Manual

cubrid_insert_id

(PECL CUBRID >= 8.3.0)

cubrid_insert_idReturns an array with the IDs generated for the AUTO_INCREMENT columns

Описание

array cubrid_insert_id ( string $class_name [, resource $conn_identifier ] )

This function returns an array with the IDs generated for the AUTO_INCREMENT columns that were updated by the previous INSERT query. It returns an array with all the AUTO_INCREMENT columns and their values. It returns 0 if the previous query does not generate new rows, or it returns FALSE on failure.

Список параметров

class_name

The name of the class (table) that was used in the last INSERT statement for which the auto increment values are retrieved.

conn_identifier

The connection identifier previously obtained by a call to cubrid_connect().

Возвращаемые значения

An associative array with all the AUTO_INCREMENT columns and their values, on success.

0, if the previous query does not generate new rows.

FALSE on failure.

Примеры

Пример #1 cubrid_insert_id() example

<?php
    $link 
cubrid_connect("localhost"30000"demodb2""dba""");
    if (!
$link)
    {
        die(
'Could not connect.');
    }
    
$query "insert into employees (name, address, salary) values ('Michael', 'Boston, MA', 3750)";
    
$result cubrid_execute($link$query);
    if (
$result
    {
        
$array_id cubrid_insert_id("employees");
        echo 
"Last insert id was ".$array_id["id"];
        
        
cubrid_close_request($result); 
    }
?>

Результат выполнения данного примера:

Result:
Last insert id was 10

CUBRID Функции
PHP Manual