I want to export the contents of my db to a csv file.
I have the code below. I get the file and download it, but its all bundled into one column, not into two like i want it to be.
Any ideas where i am going wrong.
<?
mysql_connect($hostname,$username,$tbpassword) or DIE("DATABASE FAILED TO RESPOND.");
mysql_select_db($dbName) or DIE("Database unavailable");
$result = mysql_query("select * from links");
while($row = mysql_fetch_array($result))
{
$club = $row["clubname"];
$link = $row["link"];
$content = $content. $club ."\t" .$link . "<br>";
}
?>
<?
header("Content-disposition: filename=test.csv");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<? echo $content; ?>
</body>
</html>