Location: PHPKode > projects > EasyFest > new/downloadsponsor.php
<?php

include_once("include/db_connection.php");

$TableName=$_GET['Table'];
$sql1="SELECT * FROM $TableName ";
$result1=mysql_query($sql1);
//echo $sql1;
//echo $TableName;
if( MYSQL_NUM_ROWS($result1)>0){
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"my-data.csv\"");
$data="$EventName\n"."ID".","."Added by".","."Description".","."Item Type".","."Amount Spent per income item ".","."Quantity".","."Date/Time\n";
$datetime=date("d/m/y h:i:s");
$j=1;
$numberOfRows = MYSQL_NUM_ROWS($result1);
//echo $numberOfRows;
while($numberOfRows>0){
$row=mysql_fetch_array($result1);
$data.=$j.','.$row['UserName'].','.$row['Description'].','.$row['ItemType'].','.$row['AmountSPI'].','.$row['Quantity'].','.$row['Date']."\n";
$j++;
$numberOfRows--;
}
echo $data;
}
?>

Return current item: EasyFest