prepare("UPDATE membership_fees SET payment_amount = ?, payment_date = ?, membership_start_date = ?, membership_end_date = ?, payment_status = 'PENDING', payment_id = ? WHERE user_id = ?"); $stmt->bind_param("dssssi", $payment_amount, $payment_date, $membership_start_date, $membership_end_date, $eft_id, $user_id); if ($stmt->execute()) { // Commit the transaction $conn->commit(); addSubsEFT($eft_id, $user_id, $status, $payment_amount, $description); header("Location:membership_payment.php"); // Success message $response = [ 'status' => 'success', 'message' => 'Your membership application has been updated successfully!' ]; } else { throw new Exception("Failed to update membership fee. SQL error: " . $conn->error); }