<?php
include('includes/config.php');

$id=$_POST['id'];	
$today=date( 'Y-m-d H:i:s' );
if($_POST['type']=='1'){

	 $sqlA = mysqli_query($com,"Update `withdrawal` set status = '1',createdate = '".$today."' where `id`='".$id."' ");
			


			
}else if($_POST['type']=='2') 
{
$sqlA = mysqli_query($com,"Update `withdrawal` set status = '2',createdate = '".$today."' where `id`='".$id."'");
$useridQuery=mysqli_query($com,"select * from `withdrawal` where `id`='".$id."'");
$userResult=mysqli_fetch_array($useridQuery);
$userid=$userResult['userid'];
$amount=$userResult['amount'];

$sqlwallet = mysqli_query($com,"select * from withdraw_balance where userid ='$userid'");
					  $wallert_row = mysqli_fetch_array($sqlwallet);
					  $walletbalance = $wallert_row['amount'];

$finalbalanceCredit=$walletbalance+$amount;	
$sqlwallet= mysqli_query($com,"UPDATE `withdraw_balance` SET `amount` = '$finalbalanceCredit' WHERE `userid`= '$userid'");



	}


	

?>