I have three arrays example: $array1,$array2,$array3.
I want to insert the array2 and array3 in two different columns in the same table. can i do that?
here is the code below that i am trying but it does not work for me i am doing in codeigniter:
-
controller:
$athletes_id = $this->input->post('athletes'); // array 1 $fields_id = $this->input->post('fields_id'); // array 2 $athlete_score = $this->input->post('athlete_score'); // array 3 $id = array(); foreach($athlete_score as $row){ $additional_data = array( 'test_reports_id' => $test_report_id, 'score' => $row, ); $id[] = $this->test_model->save_test_reports_details($additional_data); } for($j=0;$j<count($fields_id);$j++){ $data2 = array('fields_id' => $fields_id[$j]); $this->test_model->update_test_reports_details($id,$data2); }
-
Model :
public function update_test_reports_details($id,$data2){ $this->db->where_in('id',$id); $this->db->update('test_reports_details',$data2); }