$this->db->insert_id() seems to be wiping away my previous insert_id variables value
Here is the code:

    $the_question = $_POST['question'];
            	$the_answer = $_POST['answer'];
            	$dummy_num[] = $_POST['dummy_answer_1'];
            	$dummy_num[] = $_POST['dummy_answer_2'];
            	$dummy_num[] = $_POST['dummy_answer_3'];
            	//Get Hidden Test ID and Q_order
            	$test_id = $_POST['test_id'];
            	$q_order = $_POST['q_order'];
            	//Submit Question
            	$data_submit_q = array (
            		'type' => 1,
            		'question' => $the_question,
            		'done' => 1
            	);
            	$this->db->where('test_id', $test_id);
            	$this->db->where('q_order', $q_order);
            	$this->db->update('questions', $data_submit_q);
            	$question_id = $this->db->insert_id();
            	$time_created = date('Y-m-d H:i:s');
            	//Submit Answer 
            	$data_submit_a = array (
            		'test_id' => $test_id,
            		'question_id' => $question_id,
            		'option' => $the_answer,
            		'company_id' => $data['company']->id,
            		'job_id' => $data['session_job_id'],
            		'time_created' => $time_created
            	);
            	$this->db->insert('options', $data_submit_a);
            	$answer_id = $this->db->insert_id();
            	
            	//Let question know that answer is right.
            	$data_submit_qr = array (
            		'answer_id' => $answer_id
            	);
            	
            	$this->db->where('id', $question_id);
            	$this->db->where('test_id', $test_id);
            	$this->db->update('questions', $data_submit_qr);

Setting the answer id removes the value of the question id, then on updating the database the answer id has no value also. Even though it does right before.
$this->db->insert_id() seems to be wiping away my previous insert_id variables value
===

Here is the code:

    $the_question = $_POST['question'];
            	$the_answer = $_POST['answer'];
            	$dummy_num[] = $_POST['dummy_answer_1'];
            	$dummy_num[] = $_POST['dummy_answer_2'];
            	$dummy_num[] = $_POST['dummy_answer_3'];
            	//Get Hidden Test ID and Q_order
            	$test_id = $_POST['test_id'];
            	$q_order = $_POST['q_order'];
            	//Submit Question
            	$data_submit_q = array (
            		'type' => 1,
            		'question' => $the_question,
            		'done' => 1
            	);
            	$this->db->where('test_id', $test_id);
            	$this->db->where('q_order', $q_order);
            	$this->db->update('questions', $data_submit_q);
            	$question_id = $this->db->insert_id();
            	$time_created = date('Y-m-d H:i:s');
            	//Submit Answer 
            	$data_submit_a = array (
            		'test_id' => $test_id,
            		'question_id' => $question_id,
            		'option' => $the_answer,
            		'company_id' => $data['company']->id,
            		'job_id' => $data['session_job_id'],
            		'time_created' => $time_created
            	);
            	$this->db->insert('options', $data_submit_a);
            	$answer_id = $this->db->insert_id();
            	
            	//Let question know that answer is right.
            	$data_submit_qr = array (
            		'answer_id' => $answer_id
            	);
            	
            	$this->db->where('id', $question_id);
            	$this->db->where('test_id', $test_id);
            	$this->db->update('questions', $data_submit_qr);

Setting the answer id removes the value of the question id, then on updating the database the answer id has no value also. Even though it does right before.