// Check if the user is sending money to own account if ($iban == AccountUtils::getEmailFromIBAN ($emailId)) { echo "You can't tranfer money to your own account"; return; } // Insert the data in the TRANSACTION TABLE $db->insert($data, "TRANSACTIONS"); $updatedBalanceAfterDeduction = bcsub ($balance, $amount, FLOAT_PRECISION); //Email id of target user $emailTargetUser = AccountUtils::getEmailFromIBAN($iban); $data = array( "senderIban" => AccountUtils::getIBANFromEmail($emailId), "receiverIban" => $iban, "bic" => $bic, "amount" => $amount, "description" => "'$description'", "userId" => "'$emailTargetUser'", "date" => "'".date('Y-m-d H:i:s')."'", "closingBalance" => $balanceOfTheTargetUser, "isActive" => $isActive, "type" => "'CREDIT'" ); // Insert the credit data in the TRANSACTION TABLE $db->insert($data, "TRANSACTIONS"); $updatedBalanceAfterAddition = bcadd($balanceOfTheTargetUser, $amount, FLOAT_PRECISION);