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

$id=$_POST['id'];
//$today = date("d-m-Y");

if($_POST['type']=='1'){
    

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

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

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

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


	}


	

?>