•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 401,449 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,919 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 1548 | Replies: 0
![]() |
•
•
Join Date: Apr 2006
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
can anyone help? thanks!
<?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;
?>
<?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;
?>
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api asp blog blogger blogging blogs code combo competition dani daniweb data database debugging developer development dropdownlist gdata gentoo google gpl hacker innovation key linux microsoft module msdn news office php product programming reuse rss security serial software source spam sql survey tags vista web wysiwyg xml
- Problem with php and SQL (PHP)
- changing the .php extension and Apache mod_rewrite question (PHP)
- how to do conenction between php and my sql (PHP)
- HELP PHP w/SQL Code HELP (PHP)
- PHP/SQL query help (PHP)
Other Threads in the MySQL Forum
- Previous Thread: proj stuff
- Next Thread: Urgent Help with SQL Query


Linear Mode