<?php
    include'connection.php';
    $sql = mysqli_query($con, "SELECT * FROM recharge ORDER BY Id ASC LIMIT 10");

while ($row_user = mysqli_fetch_assoc($sql))
{   $userinfo[] = $row_user;

print_r($row_user);

header("Content-Disposition: attachment; filename=\"papi.xls\"");
header("Content-Type: application/vnd.ms-excel;");
header("Pragma: no-cache");
header("Expires: 0");
$file = fopen("php://output","w");

foreach($userinfo as $data)
   {
  fputcsv($file,explode(',',$data),"\t");
 }

  fclose($file);
 }
    
    
    
    
    
    
    
    
    
    
    
    
/*
    $qu1="SELECT Id,TxnBy FROM wallet WHERE TxnType='Generate_Amount'";
    $re1=mysqli_query($con,$qu1);
    while($data1=mysqli_fetch_array($re1))
    {
        $walletId=$data1['Id'];
        $bankName=$data1['TxnBy'];
        
        $qu2="SELECT Id FROM bank WHERE Bankname='$bankName'";
        $re2=mysqli_query($con,$qu2);
        $data2=mysqli_fetch_array($re2);
        $bankId=$data2['Id'];
        
        $update="UPDATE wallet SET TxnBy='$bankId' WHERE Id='$walletId'";
        mysqli_query($con,$update);
    }
    
    echo "UPDATED";
  */ 
    
    /*
    $rechId="2600000";
    
    
    echo $query1="INSERT INTO recharge_backup SELECT * FROM recharge WHERE Id<=$rechId";
    if(mysqli_query($con,$query1))
    {
        $query2="DELETE FROM recharge WHERE Id<=$rechId";
        if(mysqli_query($con,$query2))
        {
            echo "Successfull";
        }
        else
        {
            echo "Error_2";
        }
    }
    else
    {
        echo "Error_1";
    }
    */
?>