CodeIgniter - getting an identifier from a newly inserted database record in the same function

I need to insert some details into the database and get the identifier of the auto_incremented record that has just been inserted into the database in the same function.

First, I use a controller to tell the model to insert all the data using the following:

$this->client->add_new_client();

Then, right after that, I need to insert the customer ID, which was automatically generated by the database with the details added to the database, in another model using:

$this->model->add_new_details($client_id);

Any help would be fantastic.

Greetings

+3
source share
2 answers

- , , , , . , CI , .

PHP mysql_insert_id(), , . , INSERT, .

0

Source: https://habr.com/ru/post/1774016/


All Articles