<?php 
ob_start();
session_start();
if($_SESSION['Adminid']=="")
{
	header("location:login.php?msg1=notauthorized");
	exit();
}
	
include ("config.php");


 $id=$_GET['id'];
 
$useridQuery=mysqli_query($con,"select `userid`,`amount` from `tbl_withdrawal` where `id`='".$id."'");
$userResult=mysqli_fetch_array($useridQuery);
$userid=$userResult['userid'];
$amount=$userResult['amount'];
$walletbalance=wallet($con,'amount',$userid);
$finalbalanceCredit=$walletbalance+$amount;	
$sqlwallet= mysqli_query($con,"UPDATE `tbl_wallet` SET `amount` = '$finalbalanceCredit' WHERE `userid`= '$userid'");

 $sql="delete from tbl_withdrawal WHERE id='$id'";
$query=mysqli_query($con,$sql);

$_SESSION['withDelete'] = 'Delete Success';
header('location:withdraw_request.php');
?>