$withdraw_amount = $withdraw_amount + $withdrawal['withdraw_amount']; } } //the due amount of the member $net_amount = $amount - $withdraw_amount; //checking that input amount is less than or equal to the due amount if ($withdraw <= $net_amount) { //generate an order id with prefix withdraw $withdrawal_id = uniqid('withdraw'); //getting current date/time and expiration date $getdate = getdate(); $date = $getdate['year'] . "-" . $getdate['mon'] . "-" . $getdate['mday']; //setting the status of payment to initialy 0 $status = 0; //inserting the values in database $result = $managedata->insertWithdrawalAmount($membership_id, $withdraw, 0, $withdrawal_id, $date, $status); if ($result == 1) { header("Location: ../../ewallet.php?msg=1212"); } } else { header("Location: ../../ewallet.php?msg=7788"); } } else { if ($frozen_amount == 1) { //getting the debited amount from database $transactions = $managedata->getValue_twoCoditions("money_transfer_log", "*", "membership_id", $membership_id, "frozen_money", 1); //getting the amount debited to that member foreach ($transactions as $transaction) { //only debited values if (!empty($transaction['debit'])) { $amount = $amount + $transaction['debit'];