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?$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.
精彩评论