title: How to Update Two table Data one after other In codeigniter?
body: <p><a href="https://i.stack.imgur.com/6CZS2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6CZS2.png" alt="I create a model to update plan data but now with that i want to update the vendor_plan_task_mapping data because i use the plan data with vendor so when i update the plan after creating a vendor with some plan the updated plan data can&#39;t come to vendor task status mapping data hear i create a model for updating plan i have to update task_status_mapp table to be update...  "></a></p>
  
  <p>how to update plan with vendor_plan_task_status_mapp table. </p>
  
  <p>the model  for plan update is </p>
  
  <pre><code>public function updatePlanData(){
  
      $planId = $this-&gt;input-&gt;post('plan_id');
      $data = array(
  
                      'plan_title' =&gt; $this-&gt;input-&gt;post('plan_title'),
                      'plan_price' =&gt; $this-&gt;input-&gt;post('plan_price'),
                      'plan_desc'     =&gt; $this-&gt;input-&gt;post('plan_desc')
  
                  );
  
      $this-&gt;db-&gt;where('plan_id', $planId);
      $this-&gt;db-&gt;update('tbl_plan', $data);
  
  
      $this-&gt;db-&gt;where('plan_id',$planId);
      $this-&gt;db-&gt;delete('plan_task_mapping');
  
  
  
      foreach ($this-&gt;input-&gt;post('task_id') as $key =&gt; $value)
  
       {
          $data2 = array(
  
          'plan_id' =&gt; $planId,
          'task_id'   =&gt; $value
  
          );
       // echo "Index {$key}'s value is {$value}.";
             $this-&gt;db-&gt;insert('plan_task_mapping', $data2);
       }
  
  //-------- HEAR I NEED A CODE TO UPDATE The V_T_S_M table-----------
  
  }
  </code></pre>
  
  <p>after 1st table update i want to update the data in vendr_task_status_mapping table?????  </p>