Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:06:01+00:00 2026-06-18T04:06:01+00:00

I have written a script, which exports a CSV file with informations from Mysql

  • 0

I have written a script, which exports a CSV file with informations from Mysql databse. This script is working without problem under Linux Server(Apache) but it dosen’t work under Windows Server(Apache).

I think the Problem is here with this headers!!!

header('Content-Type: text/x-csv');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename=iBlock_download.csv');
header('Pragma: no-cache');
header("Content-Type: text/html; charset=UTF-8");

Can anyone here help?

Thanks

The Script is here:

header('Content-Type: text/x-csv');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename=iBlock_download.csv');
header('Pragma: no-cache');
header("Content-Type: text/html; charset=UTF-8");


    include('./lib/sqlString.php');
    $_id=$_GET['_id'];



$ResultPointer = mysql_query("SELECT * FROM projekte where pro_id='$_id'");
for($i = 0, $Export = ""; $i < mysql_num_rows($ResultPointer); $i++)
{

$Daten = mysql_fetch_object($ResultPointer);

$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_id);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_desc);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_exp);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_animal_nr);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_organ);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_treatment);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_comment);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_genotype);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_start_date);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_aktion);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_txt1);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_aktion);
$Spalte[] = str_replace("\"", "\"\"", $Daten->pro_user_name);

$ResultPointer2 = mysql_query("SELECT * FROM pro where fn_pro_id ='$Daten->pro_id'");
$sume=mysql_num_rows($ResultPointer2);

for($i = 0, $Export = ""; $i < mysql_num_rows($ResultPointer2); $i++)
{
$sume=mysql_num_rows($ResultPointer2);

$Daten2 = mysql_fetch_object($ResultPointer2);
$Spalte[] = str_replace("\"", "\"\"", $Daten2->fn_desc);
$Spalte[] = str_replace("\"", "\"\"", $Daten2->fn_order_date);

    }

for($j = 0; $j < count($Spalte); $j++)
{
$Export .= "\"" . $Spalte[$j] . "\"";
if($j != count($Spalte)-1)
{
$Export .= ";";
}
}
$Export .= "\r\n";
$Spalte = "";
}
echo $Export;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:06:02+00:00Added an answer on June 18, 2026 at 4:06 am

    First… don’t know how your script does it but this is a very useful function when working with csv. (http://php.net/manual/en/function.fputcsv.php)

    However… Why do you have 2 header functions that defined content-type? text/html is not needed and I would just stick to

    header('Content-Type: text/csv');  
    

    or

    header('Content-Type: text/plain');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a python script which read from a txt file and perform
This is the script I have written for gzipping content on my site, which
I am working in jquery. I have written a script which adds an image
I have written a PHP script which generates an SQL file containing all tables
I have written this short script (which I've stripped away some minor detail for
I have a PHP script which calls methods from a class I have written.
This is a follow-up to my earlier question I have written a script which
I have written a Perl CGI script which fetches an html page from a
I have written a small batch script which copies files from the a folder
I have written following script in python which works fine: from sys import argv

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.