$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 to know the affected rows for some reason.. And I need to use db transaction because there are many query.. Please help me.. Thank You ^^