How to get $this->example_model->saved() with "id"??

edited May 2019 in Support

Hi,
I can't figure out how that object should be taken for further process.
Let's assume that "id" in the "tests" table is auto-incremental.
So I'm doing like this:

//new object creation
$test_new = $this->tests_model->create( array('column1' => 'value1', 'column2' => 'value2') );

//saving new object to database
$this->tests_model->save($test_new);

// taking the saved object
$saved_test = $this->tests_model->saved();

This doesn't work for me because returned object doesn't contain the "id" value. How to get the last saved object in the database with "id"?
Please help.

Comments

Sign In or Register to comment.