tags:

views:

18

answers:

1

Hi all,

I have some data recieved from a simple HTML form like this:

$newdata =
array('Testing'=>array(
'topic'=>$data['Testing']['topic'], 
'content'=>$data['Testing']['content']),
'new'=>$data['Testing']['new'])
                 ); 

The data has been added into the database using this line of code:

$this->Testing->save($newdata);

The data has been added into the database successfully,
but I am not sure if it is possible to retrieve the ID of this new record of data
immediately after adding it into the database?

+1  A: 

$this->Testing->id will contain the ID of the newly inserted record, but if you only need to know if the data was saved, you can check the return value of save(), which is false on failure.

Mike
thank you for the quick help, Mike!