。 $ this-> db-> insert_id()を呼び出すと、最後に挿入されたデータのIDが返されます。最後にこれはあなたが識別するためのテーブル名に
function data_input($data, $file_upload) {
$insert_id_collection = array();
// first table query
$this->db->set('ID_KEY', "LASTID_SEQ.NEXTVAL", FALSE); //false escape
$this->db->insert('FIRST_TABLE', $data);
$insert_id_collection['first_table_name'] = $this->db->insert_id();
// second table query
$this->db->set('ID_KEY', "LASTID_SEQ.NEXTVAL -1", FALSE); //false escape
$this->db->insert('SECOND_TABLE', $file_upload);
$insert_id_collection['second_table_name'] = $this->db->insert_id();
// this will contain to last insert ID;
return $insert_id_collection;
}
私が入れた理由と配列のインデックス:あなたは両方のクエリの最後のインサートIDを返すために計画している場合、私はこのようにそれを行うだろうインサートIDはそれです。
は、それはあなたを助けますホープス。ハッピーコーディング