db->table($table)->update($data, $where); $affected_rows = $this->db->affectedRows(); return $affected_rows; } public function getData($table, $where = null) { $query = $this->db->table($table); if ($where) { $query->where($where); } return $query->get()->getResult(); } ## gethering Donor receipt Details for PDF. public function getInvoiceData($id) { // Fetch invoice data return $this->db->table('receipt') ->where('receipt_id', $id) ->join('donor as C','C.donor_id= receipt.donor_id','left') ->join('causes as D','D.causes_id= receipt.causes_id','left') ->join('business as B','B.business_id = receipt.business_id','left') ->select('receipt.*,CONCAT(C.first_name, IFNULL(CONCAT(" ", C.last_name), "")) as customer_name,C.address, C.postal_code,C.city, C.state,C.mobile_no as customer_mobile, C.pan_no as cust_pan_no, D.name as cause_name,C.org_name as cust_org_name') ->select('B.title ,B.business_logo,B.terms,B.address as org_address ,B.city as org_city,B.state as org_state,B.postal_code as org_zip,B.email as org_email,B.mobile_no as org_mobile, B.pan_no as org_pan, B.org_reg_no, B.signature') ->get() ->getResult(); } }