Forum Moderators: coopster
My is as follows
$fetch_order_query="SELECT o.orderid, o.status, o.total_price, g.table_name, u.fname, u.lname FROM orders o, grad_cart g, users u WHERE o.orderid = g.orderid AND o.userid = u.email and o.date='".$da."'";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=SearchOrdersToday.xls");
header("Pragma: no-cache");
header("Expires: 0");
$export = mysql_query($fetch_order_query);
$count = mysql_num_fields($export);
for ($i = 0; $i < $count; $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 = 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";
}
print "$header\n$data";
exit;
>> Sir iam unable to find out where csv fileis saving
Are you trying to save the file to your server? The way you are doing it is not actually creating a file on your server.