database - How to know affected rows using DB Transaction? -
$this->db->trans_start();         $obj = array(                 'id_supplier'=>$idsupplier,                 'nama_cp'=>$namacp,                 'email'=>$email,                 'note'=>$note         );         $this->supplier_model->updatesupplier($obj);          $this->supplier_bahan_baku_model->deletesupplierbahanbakubyidsupplier($idsupplier);         for($i = 0; $i < count($bb); $i++)          {             $obj2 = array(                 'id_supplier'=>$idsupplier,                 'id_bb'=>$bb[$i]             );             //print_r($obj2);             $this->supplier_bahan_baku_model->insertsupplierbahanbaku($obj2);         }          $this->db->trans_complete();             if($this->db->trans_status() === true)         {             if($this->db->affected_rows() > 0)             {                 echo 1;             }             else             {                 echo 0;             }         } i need know affected rows reason.. , need use db transaction because there many query.. please me.. thank ^^
i think want this.
$this->db->affected_rows(); it return affected rows, or return 0 if no rows effected.
Comments
Post a Comment