hI,
I call this exportscript for my data.
Sorry, there are some options, but I am sure you will get the idea. (Replace the pipe symbol woth a tab symbol, and you have a tab-delimited file)
session_start();
if($_SESSION[authorisatie] == '2')
{
// We maken een bestand aan
header("Content-type: application/txt");
// Met datum in de naam
$filename = "Voorregistratie_Hemipar2_".date("F_j_Y").".txt";
header("Content-Disposition: attachment; filename=$filename");
$data = TryTestAndGetvar('data');
include("../includesection/mysettings.php");
mysql_connect($db_host, $db_user, $db_password)
or die ("<b>Er was een probleem met het verbinden met de database.</b> ");
mysql_select_db($db_name);
switch($data)
{
case "participants":
$query = "select * from participants order by P_id";
$result = mysql_query($query);
$filedata = "
#------------------------------------------------------------
# Deelnemers van GBM2005 ".date("F-j-Y")."
#------------------------------------------------------------
";
$yesarray = array(1);
$noarray = array(-1,0);
$showpartarray = array("P_id", "P_title","P_initials","P_name","P_fname","P_organisation","P_department",
"P_address","P_postal","P_city","P_country","P_phone","P_fax","P_email",
"P_category","P_student","P_presentation","P_oral","P_poster","P_forum","P_stand","P_none",
"P_inserted","P_finalreg", "P_updated", "P_train");
$results = mysql_query("select * from participants") or die('Geen gegevens beschikbaar');
while($row=mysql_fetch_array($results))
{
$thiscol=0;
$row2 = $row;
$header = "";
while (list ($key, $val) = each ($row2))
{
//echo $key;
$thiscol = $thiscol+1;
if(!in_array($key, $showpartarray))
{ }
else
{
if(($val=='1') and ($key <> 'P_id'))
{
$printval = 'Yes';
}
else
{
if(($val=='0') or ($val=='-1'))
{
$printval = 'No';
}
else
{
if ($key == "P_geeftoegang")
{$printval = "******";}
else
{
$printval = $val;
}
}
}
if($key == "P_country")
{
$Cquery = "select * from country where Count_id=$val";
$Cresult = mysql_query($Cquery);
While($crow = mysql_fetch_array($Cresult))
{
$printval = $crow[Count_desc];
}
}
if(($thiscol == 1) and ($key ==0))
{
$header .= "";
$data .= "";
}
else
{
if($key == "P_updated")
{
$printval = substr($val, 0, 4)."-".substr($val, 4, 2)."-".substr($val, 6, 2);
}
$header .= $key."|";
$data .= "$printval"."|";
}
}
}
$data .="\r\n";
}
$data = $filedata."\r\n\r\n".$header."\r\n\r\n".$data;
break;
}
}
echo $data;
?>