Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same problem some how like you and i solved it like this: 1-Delete all Records of the user you want and than insert batch it like the code blow.</p> <pre><code> $employer_office = $this-&gt;input-&gt;post('employer_office'); $emp_job_type = $this-&gt;input-&gt;post('job_type'); $job_title = $this-&gt;input-&gt;post('job_title'); $job_appointment_date = $this-&gt;input-&gt;post('job_appointment_date'); $job_duration = $this-&gt;input-&gt;post('job_duration'); $job_place = $this-&gt;input-&gt;post('job_place'); $type_of_relation = $this-&gt;input-&gt;post('type_of_relation'); $monthly_salary = $this-&gt;input-&gt;post('monthly_salary'); $remarks = $this-&gt;input-&gt;post('remarks'); $all_array = array(); if($employer_office) { if(is_array($employer_office)) { for($j=0; $j&lt;count($employer_office); $j++) { $form_arr = array( 'employer_office' =&gt;$employer_office[$j], 'job_type' =&gt;$emp_job_type[$j], 'job_title' =&gt;$job_title[$j], 'job_appointment_date' =&gt;change_datei($job_appointment_date[$j]), 'job_duration' =&gt;$job_duration[$j], 'job_place' =&gt;$job_place[$j], 'type_of_relation' =&gt;$type_of_relation[$j], 'monthly_salary' =&gt;$monthly_salary[$j], 'remarks' =&gt;$remarks[$j], 'regdate' =&gt;date('Y-m-d H:m:s'), 'userid' =&gt;$id ); array_push($all_array, $form_arr); } } } if($this-&gt;history_model-&gt;delete_all('ast_jobs_history', $id)==TRUE) { if($this-&gt;history_model-&gt;all_insert('ast_jobs_history', $all_array)==TRUE) { $this-&gt;session-&gt;set_flashdata("msg","&lt;span class='m_success'&gt;".$this-&gt;lang-&gt;line('global_update_success')."&lt;/span&gt;"); redirect('history/home/list_dy','refresh'); } else { $this-&gt;session-&gt;set_flashdata("msg","&lt;span class='m_error'&gt;".$this-&gt;lang-&gt;line('global_update_error')."&lt;/span&gt;"); redirect('history/home/list_dy','refresh'); } } else { $this-&gt;load-&gt;view('unauthorized'); } </code></pre> <p>and inside the model insert_batch it.</p> <pre><code> function all_insert($tbl, $data=array()) { if(is_array($data)) { $this-&gt;db-&gt;trans_start(); $this-&gt;db-&gt;insert_batch($tbl,$data); $this-&gt;db-&gt;trans_complete(); return TRUE; } else { return FALSE; } } </code></pre> <p>bring some changes and i hope that this will give you a hint on how to solve your problem.</p> <p>or you can also do a query if you don't want to delete your records of specific id, get the data according to ID and use array_search() or in_array() function to filter your posted data and get the record you want to insert it and than insert it to database.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload