basicaly im trying to pull all records out of a table connected to a specific member, but at the moment the script i found on the net is pulling the records ok, but its not creating the XLS file its just pushing all the data to the browser??
// Edit the $Host, $User $Password, $DBName and $TableName vars only! //
$Host = "########";
$User = "admin";
$Password = "######";
$DBName = "vaaliance";
$TableName = "memberas";
// DO NOT EDIT BELOW HERE //
$link = mysql_connect ($Host, $User, $Password) or die('Could not connect: ' . mysql_error());
mysql_select_db($DBName) or die('Could not select database');
$select = "SELECT * FROM `".$TableName."`";
$export = mysql_query($select);
$fields = mysql_num_fields($export);
for ($i = 0; $i < $fields; $i++) {
$csv_output .= mysql_field_name($export, $i) . "\t";
}
while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\r","",$data);
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=database_dump.xls");
header("Pragma: no-cache");
header("Expires: 0");
print $csv_output."\n".$data;
exit;