Advertisement
GWibisono

logika diperhatikan

Mar 8th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $room=array('kamar 1','kamar 2');
  3. $disc=array(10,15);
  4. foreach($room as $cf)
  5. {
  6.     foreach($disc as $ds)
  7.     {
  8.         echo "$cf,$ds;";
  9.     }
  10.  
  11. }
  12. //hasil => kamar 1,10; kamar 1, 15; kamar 2,10; kamar 2, 15
  13. //seharusnya=> kamar 1,10; kamar 2, 15
  14. //=================solusi
  15. foreach($room as $id=>$cf)
  16. {
  17.      $ds=$room[$id];
  18.         echo "$cf,$ds;";
  19.    
  20.  
  21. }
  22. /*
  23. foreach($this->input->post('room') as $cf)
  24.             {
  25.                 foreach($this->input->post('disc') as $ds)
  26.                 {
  27.                 $k['fo_reservation_room']   = $cf;
  28.                     $editData = array(                     
  29.                         'fo_reservation_disc' => $this->db->escape_str($ds)
  30.                     );
  31.                 $this->icapps_model->updateData($this->dataTable2, $editData, $k);
  32.                 $this->icapps_model->updateData($this->dataTable13, $editData, $k);
  33.                 }
  34.             }
  35. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement