$query = $this->db->query('SELECT LAST_INSERT_ID()'); $row = $query->row_array();
$row['LAST_INSERT_ID()'];