Advertisement
riswanzone

Model untuk update package yang di input by JSON

Mar 5th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. //fungsi untuk update package yang di post dari JSON
  2.  
  3. public function update($r) {
  4.        
  5.         $id = $r['OfferedEntityUriId'];
  6.      
  7.        
  8.         $data = array(
  9.            
  10.             'OfferedEntitlementId' => $r['OfferedEntitlementId']
  11.         );
  12.        
  13.        
  14.         $this->db->where('PackageId', $id);
  15.         $this->db->update('Package_r', $data);
  16.  
  17.     $i = 0;
  18.         foreach ($r['PolicyId'] as $Duration) {
  19.             $id = $r['OfferedEntityUriId'];
  20.             $data3 = array(
  21.                
  22.                 'PolicyId'  => $r['PolicyId'][$i],
  23.             );
  24.             //$data3_all[] = $data3;
  25.             $this->db->where('PackageId', $id);
  26.             $this->db->update('Terms_r', $data3);
  27.             $i++;
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement