arsmizzou 0 Newbie Poster

can anyone help me out?

<?php
include_once "mysql_connect.php";


mysql_connection($dbc);


$select = "SELECT DISTINCT D.Title, D.FirstName, D.MiddleI, D.LastName, D.Suffix, D.Address1, D.Address2, D.City, D.State, D.Zip FROM Donor D, Pre_award P, sch_donor S WHERE Approved = 'y' AND S.Did = D.Did AND S.Scholarship_id = P.Scholarship_id";


$export = mysql_query($select);
$fields = mysql_num_fields($export);


for ($i = 0; $i < $fields; $i++) {
$header .= 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 = strtolower($value);
$value = ucwords($value);
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}


$data = str_replace("\r","",$data);


if ($data == "") {
$data = "\n(0) Records Found!\n";
}


header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=./export/recipient_env.xls");
header("Pragma:");
header("Expires: 0");
print "$header\n$data";


//echo $header."<br><br>".$data;


?>